flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmcl...@apache.org
Subject [1/5] git commit: [flex-sdk] [refs/heads/develop] - FLEX-26325 Added setToStringExcludes and some obvious minor performance improvements
Date Sat, 04 May 2013 10:38:40 GMT
Updated Branches:
  refs/heads/develop 8d6367aae -> 1ff125fcf


FLEX-26325 Added setToStringExcludes and some obvious minor performance improvements


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

Branch: refs/heads/develop
Commit: 3e740edb811e506ebcfb649d66d8ff6c3cfbbd1a
Parents: 8d6367a
Author: Justin Mclean <jmclean@apache.org>
Authored: Sat May 4 19:10:37 2013 +1000
Committer: Justin Mclean <jmclean@apache.org>
Committed: Sat May 4 19:10:37 2013 +1000

----------------------------------------------------------------------
 .../projects/rpc/src/mx/utils/RPCObjectUtil.as     |   42 ++++++++++-----
 1 files changed, 29 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/3e740edb/frameworks/projects/rpc/src/mx/utils/RPCObjectUtil.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/rpc/src/mx/utils/RPCObjectUtil.as b/frameworks/projects/rpc/src/mx/utils/RPCObjectUtil.as
index 70bd175..0901c59 100644
--- a/frameworks/projects/rpc/src/mx/utils/RPCObjectUtil.as
+++ b/frameworks/projects/rpc/src/mx/utils/RPCObjectUtil.as
@@ -57,7 +57,19 @@ public class RPCObjectUtil
     //
     //--------------------------------------------------------------------------
 
-        
+	/**
+	 *  Change deault set of strings to exclude.
+	 * 
+	 *  @langversion 3.0
+	 *  @playerversion Flash 9
+	 *  @playerversion AIR 1.1
+	 *  @productversion ApacheFlex 4.10
+	 */
+    public static function setToStringExcludes(excludes:Array):void
+	{
+		defaultToStringExcludes = excludes;
+	}
+	
     /**
      *  Pretty-prints the specified Object into a String.
      *  All properties will be in alpha ordering.
@@ -230,6 +242,7 @@ public class RPCObjectUtil
     {
         var str:String;
         var type:String = value == null ? "null" : typeof(value);
+		
         switch (type)
         {
             case "boolean":
@@ -293,7 +306,8 @@ public class RPCObjectUtil
                     indent += 2;
                     
                     // Print all of the variable values.
-                    for (var j:int = 0; j < properties.length; j++)
+					var length:int = properties.length;
+                    for (var j:int = 0; j < length; j++)
                     {
                         str = newline(str, indent);
                         prop = properties[j];
@@ -356,12 +370,12 @@ public class RPCObjectUtil
      *  This method will append a newline and the specified number of spaces
      *  to the given string.
      */
-    private static function newline(str:String, n:int = 0):String
+    private static function newline(str:String, length:int = 0):String
     {
         var result:String = str;
         result += "\n";
         
-        for (var i:int = 0; i < n; i++)
+        for (var i:int = 0; i < length; i++)
         {
             result += " ";
         }
@@ -413,7 +427,7 @@ public class RPCObjectUtil
                                         excludes:Array = null,
                                         options:Object = null):Object
     {   
-        var n:int;
+        var length:int;
         var i:int;
 
 		// this version doesn't handle ObjectProxy
@@ -475,8 +489,8 @@ public class RPCObjectUtil
         var excludeObject:Object = {};
         if (excludes)
         {
-            n = excludes.length;
-            for (i = 0; i < n; i++)
+            length = excludes.length;
+            for (i = 0; i < length; i++)
             {
                 excludeObject[excludes[i]] = 1;
             }
@@ -512,8 +526,8 @@ public class RPCObjectUtil
         }
         else if (className == "XML")
         {
-            n = properties.length();
-            for (i = 0; i < n; i++)
+            length = properties.length();
+            for (i = 0; i < length; i++)
             {
                 p = properties[i].name();
                 if (excludeObject[p] != 1)
@@ -522,11 +536,11 @@ public class RPCObjectUtil
         }
         else
         {
-            n = properties.length();
+            length = properties.length();
             var uris:Array = options.uris;
             var uri:String;
             var qName:QName;
-            for (i = 0; i < n; i++)
+            for (i = 0; i < length; i++)
             {
                 prop = properties[i];
                 p = prop.@name.toString();
@@ -593,7 +607,8 @@ public class RPCObjectUtil
         propertyNames.sort(Array.CASEINSENSITIVE |
                            (numericIndex ? Array.NUMERIC : 0));
         // remove any duplicates, i.e. any items that can't be distingushed by toString()
-        for (i = 0; i < propertyNames.length - 1; i++)
+        length = propertyNames.length;
+		for (i = 0; i < length - 1; i++)
         {
             // the list is sorted so any duplicates should be adjacent
             // two properties are only equal if both the uri and local name are identical
@@ -706,7 +721,8 @@ public class RPCObjectUtil
 
         if (excludes != null)
         {
-            for (var i:uint = 0; i < excludes.length; i++)
+			var length:int = excludes.length;
+            for (var i:uint = 0; i < length; i++)
             {
                 var excl:String = excludes[i] as String;
                 if (excl != null)


Mime
View raw message