FLEX-34119
Simplified two if statements, removed an unused variable, and removed Duplicate 
variable definition warnings in HierarchicalCollectionViewCursor.


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

Branch: refs/heads/develop
Commit: b8cc55f31da9e8c0fad497a9f7925fcc038c3d5f
Parents: 75e8db4
Author: Mihai Chira <mihai.ch...@gmail.com>
Authored: Tue Jul 22 16:42:41 2014 +0100
Committer: Mihai Chira <mihai.ch...@gmail.com>
Committed: Tue Jul 22 16:42:41 2014 +0100

----------------------------------------------------------------------
 .../HierarchicalCollectionViewCursor.as         | 29 ++++++++------------
 1 file changed, 12 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/b8cc55f3/frameworks/projects/advancedgrids/src/mx/collections/HierarchicalCollectionViewCursor.as
----------------------------------------------------------------------
diff --git 
a/frameworks/projects/advancedgrids/src/mx/collections/HierarchicalCollectionViewCursor.as
 
b/frameworks/projects/advancedgrids/src/mx/collections/HierarchicalCollectionViewCursor.as
index db52010..af7c2c0 100644
--- 
a/frameworks/projects/advancedgrids/src/mx/collections/HierarchicalCollectionViewCursor.as
+++ 
b/frameworks/projects/advancedgrids/src/mx/collections/HierarchicalCollectionViewCursor.as
@@ -91,11 +91,7 @@ public class HierarchicalCollectionViewCursor extends 
EventDispatcher
         modelCursor = model.createCursor();
         
         //check to see if the model has more than one top level items
-        if (model.length > 1)
-            more = true;
-        else 
-            more = false;
-            
+        more = model.length > 1;
     }
     
     
//--------------------------------------------------------------------------
@@ -1061,10 +1057,7 @@ public class HierarchicalCollectionViewCursor extends 
EventDispatcher
         // let it throw an IPE, the classes using this cursor will handle it
         modelCursor.seek(CursorBookmark.FIRST, 0);
         
-        if (model.length > 1)
-            more = true;
-        else
-            more = false;        
+        more = model.length > 1;
         currentChildBookmark = CursorBookmark.FIRST;
         parentNodes = [];
         parentBookmarkStack = [];
@@ -1081,8 +1074,7 @@ public class HierarchicalCollectionViewCursor extends 
EventDispatcher
         parentBookmarkStack = [];
         _currentDepth = 1;
         parentNodes = [];
-        var emptyBranch:Boolean = false;
-        
+
         //first move to the end of the top level collection
         // let it throw an IPE, the classes using this cursor will handle it
         modelCursor.seek(CursorBookmark.LAST, 0);
@@ -1155,6 +1147,9 @@ public class HierarchicalCollectionViewCursor extends 
EventDispatcher
         var parentOfCurrentNode:Object;
         var parentStack:Array = getParentStack(current);
         var isBefore:Boolean = false;
+        var parentOfChangingNodeIndex:int;
+        var isOurAncestorChanging:Boolean;
+        var bookmarkInChangingCollection:CursorBookmark;
 
         // remember the current parent
         parentOfCurrentNode = parentStack[parentStack.length - 1];
@@ -1199,15 +1194,15 @@ public class HierarchicalCollectionViewCursor extends 
EventDispatcher
                         }
                     }
                     else {
-                        var parentOfChangingNodeIndex:int = 
parentStack.indexOf(parentOfChangingNode);
-                        var isOurAncestorChanging:Boolean = 
parentOfChangingNodeIndex != -1;
+                        parentOfChangingNodeIndex = 
parentStack.indexOf(parentOfChangingNode);
+                        isOurAncestorChanging = parentOfChangingNodeIndex != 
-1;
                         if (isOurAncestorChanging)
                         {
                             if (changingNodeAndSiblings != null)
                             {
                                 var changingNodeCollectionIndex:int = 
parentOfChangingNodeIndex + 1;
                                 changingCollectionCursor = 
changingNodeAndSiblings.createCursor();
-                                var 
bookmarkInChangingCollection:CursorBookmark = 
parentBookmarkStack[changingNodeCollectionIndex];
+                                bookmarkInChangingCollection = 
parentBookmarkStack[changingNodeCollectionIndex];
                                 try
                                 {
                                     
changingCollectionCursor.seek(bookmarkInChangingCollection);
@@ -1278,15 +1273,15 @@ public class HierarchicalCollectionViewCursor extends 
EventDispatcher
                         }
                     }
                     else {
-                        var parentOfChangingNodeIndex:int = 
parentStack.indexOf(parentOfChangingNode);
-                        var isOurAncestorChanging:Boolean = 
parentOfChangingNodeIndex != -1;
+                        parentOfChangingNodeIndex = 
parentStack.indexOf(parentOfChangingNode);
+                        isOurAncestorChanging = parentOfChangingNodeIndex != 
-1;
                         if (isOurAncestorChanging)
                         {
                             if (changingNodeAndSiblings != null)
                             {
                                 var changingNodeCollectionBookmarkIndex:int = 
parentOfChangingNodeIndex + 1;
                                 changingCollectionCursor = 
changingNodeAndSiblings.createCursor();
-                                var 
bookmarkInChangingCollection:CursorBookmark = 
parentBookmarkStack[changingNodeCollectionBookmarkIndex];
+                                bookmarkInChangingCollection = 
parentBookmarkStack[changingNodeCollectionBookmarkIndex];
                                 try
                                 {
                                     
changingCollectionCursor.seek(bookmarkInChangingCollection);

Reply via email to