flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aha...@apache.org
Subject git commit: [flex-asjs] [refs/heads/develop] - FLEX-35014 add vector initializer
Date Fri, 18 Nov 2016 00:24:34 GMT
Repository: flex-asjs
Updated Branches:
  refs/heads/develop 7c71bf441 -> d2ed1ea99


FLEX-35014 add vector initializer


Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/d2ed1ea9
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/d2ed1ea9
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/d2ed1ea9

Branch: refs/heads/develop
Commit: d2ed1ea9938bd9be442b328b180ba773ac0b708b
Parents: 7c71bf4
Author: Alex Harui <aharui@apache.org>
Authored: Thu Nov 17 16:24:13 2016 -0800
Committer: Alex Harui <aharui@apache.org>
Committed: Thu Nov 17 16:24:28 2016 -0800

----------------------------------------------------------------------
 .../main/flex/org/apache/flex/utils/Language.as    | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d2ed1ea9/frameworks/projects/Language/src/main/flex/org/apache/flex/utils/Language.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Language/src/main/flex/org/apache/flex/utils/Language.as
b/frameworks/projects/Language/src/main/flex/org/apache/flex/utils/Language.as
index 2182f2d..c02ecbf 100644
--- a/frameworks/projects/Language/src/main/flex/org/apache/flex/utils/Language.as
+++ b/frameworks/projects/Language/src/main/flex/org/apache/flex/utils/Language.as
@@ -412,6 +412,7 @@ package org.apache.flex.utils
 				arr.sort(compareString);
 			}
 		}
+		
 		private static function compareStringCaseinsensitive(a:Object, b:Object):int{
 			for each(var n:String in sortNames){
 				var v:int = (a[n]||zeroStr).toString().toLowerCase().localeCompare((b[n]||zeroStr).toString().toLowerCase());
@@ -441,5 +442,21 @@ package org.apache.flex.utils
 			}
 			return 0;
 		}
+		
+		public static function Vector(size:int = 0, basetype:String = null):Array{
+			var arr:Array = [];
+			var defValue:Object = null;
+			if (basetype == "int" || basetype == "uint" || basetype == "Number")
+			{
+				defValue = 0;
+			}
+			else if (basetype == "String")
+			{
+				defValue = "";
+			}
+			for (var i:int = 0; i < size; i++)
+				arr.push(defValue);
+			return arr;
+		}
 	}
 }


Mime
View raw message