FLEX-35031 FLEX-33058
-Simplified algorithm in findAny() and findLast().
-Improved asdoc for these functions.
Note that all tests still pass.


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

Branch: refs/heads/develop
Commit: 22f81c478a097a019b2f714d1d85f3200ce69fb4
Parents: 0f811ec
Author: Mihai Chira <[email protected]>
Authored: Wed Feb 17 16:38:46 2016 +0100
Committer: Mihai Chira <[email protected]>
Committed: Wed Feb 17 16:38:46 2016 +0100

----------------------------------------------------------------------
 .../HierarchicalCollectionViewCursor.as         | 21 ++++++++++----------
 .../framework/src/mx/collections/IViewCursor.as | 18 ++++++++---------
 2 files changed, 19 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/22f81c47/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 15584ff..8b85e58 100644
--- 
a/frameworks/projects/advancedgrids/src/mx/collections/HierarchicalCollectionViewCursor.as
+++ 
b/frameworks/projects/advancedgrids/src/mx/collections/HierarchicalCollectionViewCursor.as
@@ -310,7 +310,8 @@ public class HierarchicalCollectionViewCursor extends 
EventDispatcher
      *  @inheritDoc
      *  
      *  <p>Note that for this class, the view does not need to be sorted in 
order to
-     *  call this method.</p>
+     *  call this method. Also, if the item cannot be found, the cursor 
location is
+     *  left on the last queried object.</p>
      * 
      *  @langversion 3.0
      *  @playerversion Flash 9
@@ -321,14 +322,12 @@ public class HierarchicalCollectionViewCursor extends 
EventDispatcher
     {
         seek(CursorBookmark.FIRST);
         
-        var done:Boolean = false;
-        while (!done)
+        do
         {
             if (ObjectUtil.valuesAreSubsetOfObject(valuesToMatch, 
hierarchicalData.getData(current)))
                 return true;
-
-            done = !moveNext();
         }
+        while(moveNext());
 
         return false;
     }
@@ -337,7 +336,8 @@ public class HierarchicalCollectionViewCursor extends 
EventDispatcher
      *  @inheritDoc
      *  
      *  <p>Note that for this class, the view does not need to be sorted in 
order to
-     *  call this method.</p>
+     *  call this method. Also, if the item cannot be found, the cursor 
location is
+     *  left on the last queried object.</p>
      *  
      *  @langversion 3.0
      *  @playerversion Flash 9
@@ -353,7 +353,8 @@ public class HierarchicalCollectionViewCursor extends 
EventDispatcher
      *  @inheritDoc
      *  
      *  <p>Note that for this class, the view does not need to be sorted in 
order to
-     *  call this method.</p>
+     *  call this method. Also, if the item cannot be found, the cursor 
location is
+     *  left on the last queried object.</p>
      *  
      *  @langversion 3.0
      *  @playerversion Flash 9
@@ -364,14 +365,12 @@ public class HierarchicalCollectionViewCursor extends 
EventDispatcher
     {
         seek(CursorBookmark.LAST);
         
-        var done:Boolean = false;
-        while (!done)
+        do
         {
             if (ObjectUtil.valuesAreSubsetOfObject(valuesToMatch, 
hierarchicalData.getData(current)))
                 return true;
-
-            done = !movePrevious();
         }
+        while(movePrevious());
 
         return false;
     }

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/22f81c47/frameworks/projects/framework/src/mx/collections/IViewCursor.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/framework/src/mx/collections/IViewCursor.as 
b/frameworks/projects/framework/src/mx/collections/IViewCursor.as
index 7bae4a4..9bdf61c 100644
--- a/frameworks/projects/framework/src/mx/collections/IViewCursor.as
+++ b/frameworks/projects/framework/src/mx/collections/IViewCursor.as
@@ -166,7 +166,7 @@ public interface IViewCursor extends IEventDispatcher
     /**
      *  Finds an item with the specified properties within the collection
      *  and positions the cursor to that item.
-     *  If the item can not be found, the cursor location does not change.
+     *  If the item cannot be found, the cursor location does not change.
      *
      *  <p>The <code>findAny()</code> method can only be called on sorted 
views;
      *  if the view isn't sorted, a <code>CursorError</code> is thrown.</p>
@@ -209,7 +209,7 @@ public interface IViewCursor extends IEventDispatcher
     /**
      *  Finds the first item with the specified properties within the 
collection
      *  and positions the cursor to that item.
-     *  If the item can not be found, no cursor location does not change.
+     *  If the item cannot be found, no cursor location does not change.
      *
      *  <p>The <code>findFirst()</code> method can only be called on sorted 
views;
      *  if the view isn't sorted, a <code>CursorError</code> is thrown.</p>
@@ -227,9 +227,9 @@ public interface IViewCursor extends IEventDispatcher
      *  performed, an ItemPendingError is thrown.</p>
      *
      *  @param values The search criteria. The values in the Object must be 
configured as name-value pairs,
-     *  as in an associative array (or be the actual object to search for). 
The values of the names specified must match properties
-     *  specified in the sort. For example, if properties <code>x</code>, 
<code>y</code>, and
-     *  <code>z</code> are in the current sort, the values specified should be
+     *  as in an associative array (or be the actual object to search for). 
The values of the names
+     *  specified must match properties specified in the sort. For example, if 
properties <code>x</code>,
+     *  <code>y</code>, and <code>z</code> are in the current sort, the values 
specified should be
      *  <code>{x: <i>x-value</i>, y: <i>y-value</i>, z: <i>z-value</i>}</code>.
      *
      *  @return When all of the data is local this method returns
@@ -250,7 +250,7 @@ public interface IViewCursor extends IEventDispatcher
     /**
      *  Finds the last item with the specified properties within the collection
      *  and positions the cursor on that item.
-     *  If the item can not be found, the cursor location does not chanage.
+     *  If the item cannot be found, the cursor location does not chanage.
      *
      *  <p>The <code>findLast()</code> method can only be called on sorted 
views;
      *  if the view isn't sorted, a <code>CursorError</code> is thrown.</p>
@@ -268,9 +268,9 @@ public interface IViewCursor extends IEventDispatcher
      *  performed, an ItemPendingError is thrown.</p>
      *
      *  @param values The search criteria. The values in the Object must be 
configured as name-value pairs,
-     *  as in an associative array (or be the actual object to search for). 
The values of the names specified must match properties
-     *  specified in the sort. For example, if properties <code>x</code>, 
<code>y</code>, and
-     *  <code>z</code> are in the current sort, the values specified should be
+     *  as in an associative array (or be the actual object to search for). 
The values of the names
+     *  specified must match properties specified in the sort. For example, if 
properties <code>x</code>,
+     *  <code>y</code>, and <code>z</code> are in the current sort, the values 
specified should be
      *  <code>{x: <i>x-value</i>, y: <i>y-value</i>, z: <i>z-value</i>}</code>.
      *
      *  @return When all of the data is local this method returns

Reply via email to