You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@royale.apache.org by GitBox <gi...@apache.org> on 2018/05/21 07:08:06 UTC

[GitHub] alinakazi closed pull request #148: Sort and SortField Added

alinakazi closed pull request #148: Sort and SortField Added
URL: https://github.com/apache/royale-asjs/pull/148
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/frameworks/projects/MXRoyale/src/main/royale/MXRoyaleClasses.as b/frameworks/projects/MXRoyale/src/main/royale/MXRoyaleClasses.as
index 90cf4b78e..feadb86e2 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/MXRoyaleClasses.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/MXRoyaleClasses.as
@@ -35,9 +35,12 @@ internal class MXRoyaleClasses
 	import mx.containers.beads.ApplicationLayout; ApplicationLayout;
 	import mx.containers.beads.BoxLayout; BoxLayout;
 	import mx.containers.ControlBar; ControlBar;
-    import mx.containers.Panel; Panel;
+  import mx.containers.Panel; Panel;
 	import mx.controls.ToolTip; ToolTip;
 	import mx.controls.beads.ToolTipBead; ToolTipBead;
+	import mx.collections.SortField; SortField;
+	import mx.collections.Sort; Sort;
+	
 	import mx.effects.IEffectInstance; IEffectInstance;
 	import mx.events.EffectEvent; EffectEvent;
 	import mx.graphics.Stroke; Stroke;
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/collections/ISort.as b/frameworks/projects/MXRoyale/src/main/royale/mx/collections/ISort.as
index 217900c27..ed8b5cd34 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/collections/ISort.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/collections/ISort.as
@@ -1,353 +1,353 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-//  Licensed to the Apache Software Foundation (ASF) under one or more
-//  contributor license agreements.  See the NOTICE file distributed with
-//  this work for additional information regarding copyright ownership.
-//  The ASF licenses this file to You under the Apache License, Version 2.0
-//  (the "License"); you may not use this file except in compliance with
-//  the License.  You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-//  Unless required by applicable law or agreed to in writing, software
-//  distributed under the License is distributed on an "AS IS" BASIS,
-//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-//  See the License for the specific language governing permissions and
-//  limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////////
-
-package mx.collections
-{
-
-    /**
-     *  The <code>ISort</code> interface defines the interface for classes that
-     *  provide the sorting information required to sort the
-     *  data of a collection view.
-     * 
-     *  @see mx.collections.ICollectionView
-     *  @see mx.collections.ISortField
-     *  
-     *  @langversion 3.0
-     *  @playerversion Flash 9
-     *  @playerversion AIR 1.1
-     *  @productversion Flex 4.5
-     */
-public interface ISort
-{
-    //--------------------------------------------------------------------------
-    //
-    //  Properties
-    //
-    //--------------------------------------------------------------------------
-
-    /**
-     *  The method used to compare items when sorting.
-     *  If you specify this property, Flex ignores any 
-     *  <code>compareFunction</code> properties that you specify in the 
-     *  <code>ISortField</code> objects that you use in this class.
-     *
-     *  <p>The compare function must have the following signature:</p>
-     *
-     *  <pre><code>
-     *
-     *     function [name](a:Object, b:Object, fields:Array = null):int
-     *
-     *  </code></pre>
-     *
-     *  <p>This function must return the following value:
-     *  <ul>
-     *        <li>-1, if the <code>Object a</code> should appear before the 
-     *        <code>Object b</code> in the sorted sequence</li>
-     *        <li>0, if the <code>Object a</code> equals the 
-     *        <code>Object b</code></li>
-     *        <li>1, if the <code>Object a</code> should appear after the 
-     *        <code>Object b</code> in the sorted sequence</li>
-     *  </ul></p>
-     *  <p>To return to the internal comparision function, set this value to
-     *  <code>null</code>.</p>
-     *  <p>
-     *  The <code>fields</code> array specifies the object fields
-     *  to compare.
-     *  Typically the algorithm will compare properties until the field list is
-     *  exhausted or a non-zero value can be returned.
-     *  For example:</p>
-     *
-     *  <pre><code>
-     *    function myCompare(a:Object, b:Object, fields:Array = null):int
-     *    {
-     *        var result:int = 0;
-     *        var i:int = 0;
-     *        var propList:Array = fields ? fields : internalPropList;
-     *        var len:int = propList.length;
-     *        var propName:String;
-     *        while (result == 0 &amp;&amp; (i &lt; len))
-     *        {
-     *            propName = propList[i];
-     *            result = compareValues(a[propName], b[propName]);
-     *            i++;
-     *        }
-     *        return result;
-     *    }
-     *
-     *    function compareValues(a:Object, b:Object):int
-     *    {
-     *        if (a == null &amp;&amp; b == null)
-     *            return 0;
-     *
-     *        if (a == null)
-     *          return 1;
-     *
-     *        if (b == null)
-     *           return -1;
-     *
-     *        if (a &lt; b)
-     *            return -1;
-     *
-     *        if (a &gt; b)
-     *            return 1;
-     *
-     *        return 0;
-     *    }
-     *  </code></pre>
-     *
-     *  <p>The default value is an internal compare function that can perform
-     *  a string, numeric, or date comparison in ascending or descending order.
-     *  Specify your own function only if you need a need a custom
-     *  comparison algorithm. This is normally only the case if a calculated
-     *  field is used in a display.</p>
-     *
-     *  <p>Alternatively you can specify separate compare functions for each
-     *  sort field by using the <code>ISortField</code> class 
-     *  <code>compareFunction</code> property; This way you can use the default 
-     *  comparison for some fields and a custom comparison for others.</p>
-     *
-     *  @langversion 3.0
-     *  @playerversion Flash 9
-     *  @playerversion AIR 1.1
-     *  @productversion Flex 4.5
-     */
-    function get compareFunction():Function;
-
-    /**
-     *  @deprecated A future release of Apache Flex SDK will remove this function. Please use the constructor
-     *  argument instead.
-     */
-    function set compareFunction(value:Function):void;
-
-    /**
-     *  An <code>Array</code> of <code>ISortField</code> objects that
-     *  specifies the fields to compare.
-     *  The order of the ISortField objects in the array determines
-     *  field priority order when sorting.
-     *  The default sort comparator checks the sort fields in array
-     *  order until it determinines a sort order for the two
-     *  fields being compared.
-     *
-     *  @default null
-     *
-     *  @see ISortField
-     *
-     *  @langversion 3.0
-     *  @playerversion Flash 9
-     *  @playerversion AIR 1.1
-     *  @productversion Flex 4.5
-     */
-    function get fields():Array;
-
-    /**
-     *  @deprecated A future release of Apache Flex SDK will remove this function. Please use the constructor
-     *  argument instead.
-     */
-    function set fields(value:Array):void;
-
-    /**
-     *  Indicates if the sort should be unique.
-     *  Unique sorts fail if any value or combined value specified by the
-     *  fields listed in the fields property result in an indeterminate or
-     *  non-unique sort order; that is, if two or more items have identical
-     *  sort field values. An error is thrown if the sort is not unique.
-     *  The sorting logic uses this <code>unique</code> property value only if sort
-     *  field(s) are specified explicitly. If no sort fields are specified
-     *  explicitly, no error is thrown even when there are identical value
-     *  elements.
-     *
-     *  @default false
-     *
-     *  @langversion 3.0
-     *  @playerversion Flash 9
-     *  @playerversion AIR 1.1
-     *  @productversion Flex 4.5
-     */
-    function get unique():Boolean;
-
-    /**
-     *  @deprecated A future release of Apache Flex SDK will remove this function. Please use the constructor
-     *  argument instead.
-     */
-    function set unique(value:Boolean):void;
-
-    //--------------------------------------------------------------------------
-    //
-    //  Methods
-    //
-    //--------------------------------------------------------------------------
-
-    /**
-     *  Finds the specified object within the specified array (or the insertion
-     *  point if asked for), returning the index if found or -1 if not.
-     *  The <code>ListCollectionView</code> class <code>find<i>xxx</i>()</code> 
-     *  methods use this method to find the requested item; as a general rule, 
-     *  it is easier to use these functions, and not <code>findItem()</code> 
-     *  to find data in <code>ListCollectionView</code>-based objects.
-     *  You call the <code>findItem()</code> method directly when writing a
-     *  class that supports sorting, such as a new <code>ICollectionView</code>
-     *  implementation.
-     *  The input items array need to be sorted before calling this function.
-     *  Otherwise this function will not be able to find the specified value
-     *  properly.
-     *
-     *  @param items the Array within which to search.
-     *  @param values Object containing the properties to look for (or
-     *                the object to search for, itself).
-     *                The object must consist of field name/value pairs, where
-     *                the field names are names of fields specified by the
-     *                <code>fields</code> property, in the same order they
-     *                are used in that property.
-     *                You do not have to specify all of the fields from the
-     *                <code>fields</code> property, but you
-     *                cannot skip any in the order.
-     *                Therefore, if the <code>fields</code>
-     *                properity lists three fields, you can specify its first
-     *                and second fields in this parameter, but you cannot
-     *                specify  only the first and third fields.
-     *  @param mode String containing the type of find to perform.
-     *           Valid values are:
-     *             <table>
-     *               <tr>
-     *                 <th>ANY_INDEX_MODE</th> 
-     *                 <th>Return any position that
-     *                   is valid for the values.</th>
-     *               </tr>
-     *               <tr>
-     *                 <th>FIRST_INDEX_MODE</th> 
-     *                 <th>Return the position
-     *                   where the first occurrance of the values is found.</th>
-     *               </tr>
-     *               <tr>
-     *                 <th>LAST_INDEX_MODE</th> 
-     *                 <th>Return the position where the
-     *                   last ocurrance of the specified values is found.
-     *                 </th>
-     *               </tr>
-     *               </table>
-     *  @param returnInsertionIndex If the method does not find an item
-     *                     identified by the <code>values</code> parameter,
-     *                     and this parameter is <code>true</code> the 
-     *                     <code>findItem()</code>
-     *                     method returns the insertion point for the values,
-     *                     that is the point in the sorted order where you
-     *                     should insert the item.
-     *  @param compareFunction a comparator function to use to find the item.
-     *                 If you do not specify this parameter or , or if you 
-     *                 provide a <code>null</code> value, 
-     *                 <code>findItem()</code> function uses the
-     *                 compare function determined by the <code>ISort</code>
-     *                 instance's <code>compareFunction</code> property,
-     *                 passing in the array of fields determined
-     *                 by the values object and the current 
-     *                 <code>SortFields</code>.
-     *
-     *                 If you provide a non-null value, <code>findItem()</code>
-     *                 function uses it as the compare function.
-     *
-     *                 The signature of the function passed as 
-     *                 <code>compareFunction</code> must be as follows: 
-     *                 <code>function myCompareFunction(a:Object, b:Object):int</code>.
-     *                 Note that there is no third argument unlike the
-     *                 compare function for <code>ISort.compareFunction()</code>
-     *                 property.
-     *  @return int The index in the array of the found item.
-     *                If the <code>returnInsertionIndex</code> parameter is
-     *              <code>false</code> and the item is not found, returns -1.
-     *                If the <code>returnInsertionIndex</code> parameter is
-     *              <code>true</code> and the item is not found, returns
-     *                the index of the point in the sorted array where the
-     *                values would be inserted.
-     *
-     *  @throws SortError If there are any parameter errors,
-     *          the find critieria is not compatible with the sort
-     *          or the comparator function for the sort can not be determined.
-     * 
-     *  @langversion 3.0
-     *  @playerversion Flash 9
-     *  @playerversion AIR 1.1
-     *  @productversion Flex 4.5
-     */
-    function findItem(
-                items:Array,
-                values:Object,
-                mode:String,
-                returnInsertionIndex:Boolean = false,
-                compareFunction:Function = null):int;
-
-    /**
-     *  Return whether the specified property is used to control the sort.
-     *  The function cannot determine a definitive answer if the sort uses a
-     *  custom comparator; it always returns <code>true</code> in this case.
-     *
-     *  @param property The name of the field to test.
-     *  @return Whether the property value might affect the sort outcome.
-     *  If the sort uses the default compareFunction, returns
-     *  <code>true</code> if the
-     *  <code>property</code> parameter specifies a sort field.
-     *  If the sort or any <code>ISortField</code> uses a custom comparator,
-     *  there's no way to know, so return <code>true</code>.
-     *
-     *  @langversion 3.0
-     *  @playerversion Flash 9
-     *  @playerversion AIR 1.1
-     *  @productversion Flex 4.5
-     */
-    function propertyAffectsSort(property:String):Boolean;
-
-    /**
-     *  Goes through the <code>fields</code> array and calls 
-     *  <code>reverse()</code> on each of the <code>ISortField</code> objects in 
-     *  the array. If the field was descending now it is ascending, 
-     *  and vice versa.
-     *
-     *  <p>Note: an <code>ICollectionView</code> does not automatically 
-     *  update when the objects in the <code>fields</code> array are modified; 
-     *  call its <code>refresh()</code> method to update the view.</p>
-     *
-     *  <p>Note: a future release of Apache Flex SDK will change the signature
-     *  of this function to return a reversed clone of this Sort instance. See
-     *  FLEX-34853.</p>
-     *
-     *  @langversion 3.0
-     *  @playerversion Flash 9
-     *  @playerversion AIR 1.1
-     *  @productversion Flex 4.5
-     */
-    function reverse():void;
-
-    /**
-     *  Apply the current sort to the specified array (not a copy).
-     *  To prevent the array from being modified, create a copy
-     *  use the copy in the <code>items</code> parameter.
-     *
-     *  <p>Flex <code>ICollectionView</code> implementations call the 
-     *  <code>sort</code> method automatically and ensure that the sort is 
-     *  performed on a copy of the underlying data.</p>
-     *
-     *  @param items Array of items to sort.
-     *
-     *  @langversion 3.0
-     *  @playerversion Flash 9
-     *  @playerversion AIR 1.1
-     *  @productversion Flex 4.5
-     */
-   function sort(items:Array):void;
-}
-}
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+package mx.collections
+{
+
+    /**
+     *  The <code>ISort</code> interface defines the interface for classes that
+     *  provide the sorting information required to sort the
+     *  data of a collection view.
+     * 
+     *  @see mx.collections.ICollectionView
+     *  @see mx.collections.ISortField
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Royale 0.9.4
+     */
+public interface ISort
+{
+    //--------------------------------------------------------------------------
+    //
+    //  Properties
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  The method used to compare items when sorting.
+     *  If you specify this property, Flex ignores any 
+     *  <code>compareFunction</code> properties that you specify in the 
+     *  <code>ISortField</code> objects that you use in this class.
+     *
+     *  <p>The compare function must have the following signature:</p>
+     *
+     *  <pre><code>
+     *
+     *     function [name](a:Object, b:Object, fields:Array = null):int
+     *
+     *  </code></pre>
+     *
+     *  <p>This function must return the following value:
+     *  <ul>
+     *        <li>-1, if the <code>Object a</code> should appear before the 
+     *        <code>Object b</code> in the sorted sequence</li>
+     *        <li>0, if the <code>Object a</code> equals the 
+     *        <code>Object b</code></li>
+     *        <li>1, if the <code>Object a</code> should appear after the 
+     *        <code>Object b</code> in the sorted sequence</li>
+     *  </ul></p>
+     *  <p>To return to the internal comparision function, set this value to
+     *  <code>null</code>.</p>
+     *  <p>
+     *  The <code>fields</code> array specifies the object fields
+     *  to compare.
+     *  Typically the algorithm will compare properties until the field list is
+     *  exhausted or a non-zero value can be returned.
+     *  For example:</p>
+     *
+     *  <pre><code>
+     *    function myCompare(a:Object, b:Object, fields:Array = null):int
+     *    {
+     *        var result:int = 0;
+     *        var i:int = 0;
+     *        var propList:Array = fields ? fields : internalPropList;
+     *        var len:int = propList.length;
+     *        var propName:String;
+     *        while (result == 0 &amp;&amp; (i &lt; len))
+     *        {
+     *            propName = propList[i];
+     *            result = compareValues(a[propName], b[propName]);
+     *            i++;
+     *        }
+     *        return result;
+     *    }
+     *
+     *    function compareValues(a:Object, b:Object):int
+     *    {
+     *        if (a == null &amp;&amp; b == null)
+     *            return 0;
+     *
+     *        if (a == null)
+     *          return 1;
+     *
+     *        if (b == null)
+     *           return -1;
+     *
+     *        if (a &lt; b)
+     *            return -1;
+     *
+     *        if (a &gt; b)
+     *            return 1;
+     *
+     *        return 0;
+     *    }
+     *  </code></pre>
+     *
+     *  <p>The default value is an internal compare function that can perform
+     *  a string, numeric, or date comparison in ascending or descending order.
+     *  Specify your own function only if you need a need a custom
+     *  comparison algorithm. This is normally only the case if a calculated
+     *  field is used in a display.</p>
+     *
+     *  <p>Alternatively you can specify separate compare functions for each
+     *  sort field by using the <code>ISortField</code> class 
+     *  <code>compareFunction</code> property; This way you can use the default 
+     *  comparison for some fields and a custom comparison for others.</p>
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Royale 0.9.4
+     */
+    //function get compareFunction():Function;
+
+    /**
+     *  @deprecated A future release of Apache Flex SDK will remove this function. Please use the constructor
+     *  argument instead.
+     */
+    //function set compareFunction(value:Function):void;
+
+    /**
+     *  An <code>Array</code> of <code>ISortField</code> objects that
+     *  specifies the fields to compare.
+     *  The order of the ISortField objects in the array determines
+     *  field priority order when sorting.
+     *  The default sort comparator checks the sort fields in array
+     *  order until it determinines a sort order for the two
+     *  fields being compared.
+     *
+     *  @default null
+     *
+     *  @see ISortField
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Royale 0.9.4
+     */
+    function get fields():Array;
+
+    /**
+     *  @deprecated A future release of Apache Flex SDK will remove this function. Please use the constructor
+     *  argument instead.
+     */
+    function set fields(value:Array):void;
+
+    /**
+     *  Indicates if the sort should be unique.
+     *  Unique sorts fail if any value or combined value specified by the
+     *  fields listed in the fields property result in an indeterminate or
+     *  non-unique sort order; that is, if two or more items have identical
+     *  sort field values. An error is thrown if the sort is not unique.
+     *  The sorting logic uses this <code>unique</code> property value only if sort
+     *  field(s) are specified explicitly. If no sort fields are specified
+     *  explicitly, no error is thrown even when there are identical value
+     *  elements.
+     *
+     *  @default false
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Royale 0.9.4
+     */
+   // function get unique():Boolean;
+
+    /**
+     *  @deprecated A future release of Apache Flex SDK will remove this function. Please use the constructor
+     *  argument instead.
+     */
+   // function set unique(value:Boolean):void;
+
+    //--------------------------------------------------------------------------
+    //
+    //  Methods
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  Finds the specified object within the specified array (or the insertion
+     *  point if asked for), returning the index if found or -1 if not.
+     *  The <code>ListCollectionView</code> class <code>find<i>xxx</i>()</code> 
+     *  methods use this method to find the requested item; as a general rule, 
+     *  it is easier to use these functions, and not <code>findItem()</code> 
+     *  to find data in <code>ListCollectionView</code>-based objects.
+     *  You call the <code>findItem()</code> method directly when writing a
+     *  class that supports sorting, such as a new <code>ICollectionView</code>
+     *  implementation.
+     *  The input items array need to be sorted before calling this function.
+     *  Otherwise this function will not be able to find the specified value
+     *  properly.
+     *
+     *  @param items the Array within which to search.
+     *  @param values Object containing the properties to look for (or
+     *                the object to search for, itself).
+     *                The object must consist of field name/value pairs, where
+     *                the field names are names of fields specified by the
+     *                <code>fields</code> property, in the same order they
+     *                are used in that property.
+     *                You do not have to specify all of the fields from the
+     *                <code>fields</code> property, but you
+     *                cannot skip any in the order.
+     *                Therefore, if the <code>fields</code>
+     *                properity lists three fields, you can specify its first
+     *                and second fields in this parameter, but you cannot
+     *                specify  only the first and third fields.
+     *  @param mode String containing the type of find to perform.
+     *           Valid values are:
+     *             <table>
+     *               <tr>
+     *                 <th>ANY_INDEX_MODE</th> 
+     *                 <th>Return any position that
+     *                   is valid for the values.</th>
+     *               </tr>
+     *               <tr>
+     *                 <th>FIRST_INDEX_MODE</th> 
+     *                 <th>Return the position
+     *                   where the first occurrance of the values is found.</th>
+     *               </tr>
+     *               <tr>
+     *                 <th>LAST_INDEX_MODE</th> 
+     *                 <th>Return the position where the
+     *                   last ocurrance of the specified values is found.
+     *                 </th>
+     *               </tr>
+     *               </table>
+     *  @param returnInsertionIndex If the method does not find an item
+     *                     identified by the <code>values</code> parameter,
+     *                     and this parameter is <code>true</code> the 
+     *                     <code>findItem()</code>
+     *                     method returns the insertion point for the values,
+     *                     that is the point in the sorted order where you
+     *                     should insert the item.
+     *  @param compareFunction a comparator function to use to find the item.
+     *                 If you do not specify this parameter or , or if you 
+     *                 provide a <code>null</code> value, 
+     *                 <code>findItem()</code> function uses the
+     *                 compare function determined by the <code>ISort</code>
+     *                 instance's <code>compareFunction</code> property,
+     *                 passing in the array of fields determined
+     *                 by the values object and the current 
+     *                 <code>SortFields</code>.
+     *
+     *                 If you provide a non-null value, <code>findItem()</code>
+     *                 function uses it as the compare function.
+     *
+     *                 The signature of the function passed as 
+     *                 <code>compareFunction</code> must be as follows: 
+     *                 <code>function myCompareFunction(a:Object, b:Object):int</code>.
+     *                 Note that there is no third argument unlike the
+     *                 compare function for <code>ISort.compareFunction()</code>
+     *                 property.
+     *  @return int The index in the array of the found item.
+     *                If the <code>returnInsertionIndex</code> parameter is
+     *              <code>false</code> and the item is not found, returns -1.
+     *                If the <code>returnInsertionIndex</code> parameter is
+     *              <code>true</code> and the item is not found, returns
+     *                the index of the point in the sorted array where the
+     *                values would be inserted.
+     *
+     *  @throws SortError If there are any parameter errors,
+     *          the find critieria is not compatible with the sort
+     *          or the comparator function for the sort can not be determined.
+     * 
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Royale 0.9.4
+     */
+  /*   function findItem(
+                items:Array,
+                values:Object,
+                mode:String,
+                returnInsertionIndex:Boolean = false,
+                compareFunction:Function = null):int; */
+
+    /**
+     *  Return whether the specified property is used to control the sort.
+     *  The function cannot determine a definitive answer if the sort uses a
+     *  custom comparator; it always returns <code>true</code> in this case.
+     *
+     *  @param property The name of the field to test.
+     *  @return Whether the property value might affect the sort outcome.
+     *  If the sort uses the default compareFunction, returns
+     *  <code>true</code> if the
+     *  <code>property</code> parameter specifies a sort field.
+     *  If the sort or any <code>ISortField</code> uses a custom comparator,
+     *  there's no way to know, so return <code>true</code>.
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Royale 0.9.4
+     */
+    /* function propertyAffectsSort(property:String):Boolean; */
+
+    /**
+     *  Goes through the <code>fields</code> array and calls 
+     *  <code>reverse()</code> on each of the <code>ISortField</code> objects in 
+     *  the array. If the field was descending now it is ascending, 
+     *  and vice versa.
+     *
+     *  <p>Note: an <code>ICollectionView</code> does not automatically 
+     *  update when the objects in the <code>fields</code> array are modified; 
+     *  call its <code>refresh()</code> method to update the view.</p>
+     *
+     *  <p>Note: a future release of Apache Flex SDK will change the signature
+     *  of this function to return a reversed clone of this Sort instance. See
+     *  FLEX-34853.</p>
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Royale 0.9.4
+     */
+    /* function reverse():void; */
+
+    /**
+     *  Apply the current sort to the specified array (not a copy).
+     *  To prevent the array from being modified, create a copy
+     *  use the copy in the <code>items</code> parameter.
+     *
+     *  <p>Flex <code>ICollectionView</code> implementations call the 
+     *  <code>sort</code> method automatically and ensure that the sort is 
+     *  performed on a copy of the underlying data.</p>
+     *
+     *  @param items Array of items to sort.
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Royale 0.9.4
+     */
+   /* function sort(items:Array):void; */
+}
+}
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/collections/ISortField.as b/frameworks/projects/MXRoyale/src/main/royale/mx/collections/ISortField.as
new file mode 100644
index 000000000..bd516972a
--- /dev/null
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/collections/ISortField.as
@@ -0,0 +1,272 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+package mx.collections
+{
+/**
+ *  The <code>ISortField</code> interface defines the interface for classes that
+ *  are used with <code>ISort</code> classes, to provide the sorting information
+ *  required to sort the specific fields or property in a collection view.
+ * 
+ *  @langversion 3.0
+ *  @playerversion Flash 9
+ *  @playerversion AIR 1.1
+ *  @productversion Royale 0.9.4
+ */
+public interface ISortField
+    {
+    //--------------------------------------------------------------------------
+    //
+    //  Properties
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  This helper property is used internally by the <code>findItem()</code> 
+     *  and <code>sort()</code> methods. Other uses of this property are not 
+     *  supported.
+     *  Returns -1 if this ISortField shouldn't be used by the <code>Sort</code>
+     *  class to sort the field (there is no compareFunction or no name). Otherwise, returns a bitmask of sort options.
+     * 
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Royale 0.9.4
+     */
+   // function get arraySortOnOptions():int;
+
+    /**
+     *  The function that compares two items during a sort of items for the
+     *  associated collection. If you specify a <code>compareFunction</code>
+     *  property in an ISort object, Flex ignores any 
+     *  <code>compareFunction</code> properties of the ISort's ISortField
+     *  objects.
+     *  <p>The compare function must have the following signature:</p>
+     *
+     *  <p><code>function myCompare(a:Object, b:Object):int</code></p>
+     *
+     *  <p>This function returns the following values:</p>
+     *
+     *   <ul>
+     *        <li>-1, if <code>a</code> should appear before <code>b</code> in
+     *        the sorted sequence</li>
+     *        <li>0, if <code>a</code> equals <code>b</code></li>
+     *        <li>1, if <code>a</code> should appear after <code>b</code> in the
+     *        sorted sequence</li>
+     *  </ul>
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Royale 0.9.4
+     */
+   // function get compareFunction():Function;
+
+    /**
+     *  @deprecated A future release of Apache Flex SDK will remove this function. Please use the constructor
+     *  argument instead.
+     */
+  //  function set compareFunction(c:Function):void;
+
+    /**
+     *  Specifies whether this field should be sorted in descending
+     *  order.
+     *
+     *  <p>The default value is <code>false</code> (ascending).</p>
+     * 
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Royale 0.9.4
+     */
+  //  function get descending():Boolean;
+
+    /**
+     *  @deprecated A future release of Apache Flex SDK will remove this function. Please use the constructor
+     *  argument instead.
+     */
+   // function set descending(value:Boolean):void;
+
+    /**
+     *  The name of the field to be sorted.
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Royale 0.9.4
+     */
+    function get name():String;
+
+    /**
+     *  @deprecated A future release of Apache Flex SDK will remove this function. Please use the constructor
+     *  argument instead.
+     */
+    function set name(n:String):void;
+
+    /**
+     *  Specifies that if the field being sorted contains numeric
+     *  (<code>number/int/uint</code>) values, or string representations of numeric values,
+     *  the comparator use a numeric comparison.
+     *  <p>
+     *  This property is used by <code>SortField</code> class in case custom compare
+     *  function is not provided.
+     *  </p>
+     *  <p>
+     *  If this property is <code>true</code>, the built-in numeric compare
+     *  function is used. Each of data items is cast to a
+     *  <code>Number()</code> function before the comparison.
+     *  </p>
+     *  <p>
+     *  If this property is <code>false</code>, the built-in string compare
+     *  function is used. Each of data items is cast to a
+     *  <code>String()</code> function before the comparison.
+     *  </p>
+     *  <p>
+     *  If this property is <code>null</code>, the first data item
+     *  is introspected to see if it is a number or string and the sort
+     *  proceeds based on that introspection.
+     *  </p>
+     *  
+     *  @default null
+     *  
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Royale 0.9.4
+     */
+    function get numeric():Object;
+
+    /**
+     *  @deprecated A future release of Apache Flex SDK will remove this function. Please use the constructor
+     *  argument instead.
+     */
+    function set numeric(value:Object):void;
+
+
+    /**
+     *  Specifies what compare type will be used for the sortField. This overrides the default
+     *  behavior.
+     * 
+     *  @default null
+     * 
+     *  @langversion 3.0
+     *  @playerversion Flash 11.8
+     *  @playerversion AIR 3.8
+     *  @productversion Royale 0.9.4
+     */
+  //  function get sortCompareType():String;
+
+    /**
+     *  @deprecated A future release of Apache Flex SDK will remove this function. Please use the constructor
+     *  argument instead.
+     */
+  //  function set sortCompareType(value:String):void;
+
+
+    /**
+     *  True if this <code>ISortField</code> uses a custom comparator function.
+     *
+     *  @see @compareFunction
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Royale 0.9.4
+     */
+  //  function get usingCustomCompareFunction():Boolean;
+
+    //--------------------------------------------------------------------------
+    //
+    //  Methods
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  A helper function called by the <code>Sort</code> class to set the
+     *  default comparison function to perform a comparison based on
+     *  one of three things: whether or not a custom compare function has
+     *  been set, the data type for the specified field or the the value of the
+     *  numeric property. If the the <code>numeric</code> property is true,
+     *  then a numeric comparison will be performed when sorting.
+     *
+     *  @param obj The object that contains the data. If the field name has
+     *  been set with the name property, then the name will be used to access
+     *  the data value from this object. Otherwise the object itself will
+     *  be used as the data value.
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Royale 0.9.4
+     */
+  //  function initializeDefaultCompareFunction(obj:Object):void;
+
+    /**
+     *  Reverse the criteria for this sort field.
+     *  If the field was sorted in descending order, for example, sort it
+     *  in ascending order.
+     *
+     *  <p>NOTE: An <code>ICollectionView</code> does not automatically 
+     *  update when the <code>ISortFields</code> are modified; call its 
+     *  <code>refresh()</code> method to update the view.</p>
+     *
+     *  <p>Note: a future release of Apache Flex SDK will change the signature
+     *  of this function to return a reversed clone of this SortField instance.
+     *  See FLEX-34853 for more details.</p>
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Royale 0.9.4
+     */
+   // function reverse():void;
+
+
+    /**
+     *  This changes the internal compare function used by the <code>SortField</code> based
+     *  on the value of <code>sortCompareType</code>.
+     *
+     *  @deprecated A future release of Apache Flex SDK will remove this function in favour of
+     *  making ISortField instances immutable.
+     * 
+     *  @return true for successfully matched or false for failure to match the <code>sortCompareType</code>.
+     * 
+     *  @langversion 3.0
+     *  @playerversion Flash 11.8
+     *  @playerversion AIR 3.8
+     *  @productversion Royale 0.9.4
+     */
+   // function updateSortCompareType():Boolean;
+
+    /**
+     *  Returns true if the object has the field required by this <code>ISortField</code> instance.
+     *  In  the case of <code>ComplexSortField</code>, returns true if the object has a field with
+     *  an identical name to the first part of the <code>namePath</code>.
+     *
+     *  @return true if the object has the field required by this <code>ISortField</code> instance.
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 11.8
+     *  @playerversion AIR 3.8
+     *  @productversion Royale 0.9.4
+     */
+  //  function objectHasSortField(object:Object):Boolean;
+}
+}
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/collections/Sort.as b/frameworks/projects/MXRoyale/src/main/royale/mx/collections/Sort.as
new file mode 100644
index 000000000..39dc1f28d
--- /dev/null
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/collections/Sort.as
@@ -0,0 +1,227 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+package mx.collections
+{
+
+  /* 
+    import flash.events.Event;
+    import flash.events.EventDispatcher; */
+	
+	import org.apache.royale.events.Event;
+	import org.apache.royale.events.EventDispatcher;
+
+    //import mx.collections.errors.SortError;
+    import mx.core.mx_internal;
+  /*   import mx.resources.IResourceManager;
+    import mx.resources.ResourceManager */;
+    import mx.utils.ObjectUtil;
+
+    use namespace mx_internal;
+ 
+    [DefaultProperty("fields")]
+[ResourceBundle("collections")] 
+/* [Alternative(replacement="spark.collections.Sort", since="4.5")]
+ */
+/**
+ *  Provides the sorting information required to establish a sort on an
+ *  existing view (<code>ICollectionView</code> interface or class that
+ *  implements the interface). After you assign a <code>Sort</code> instance to the view's
+ *  <code>sort</code> property, you must call the view's
+ *  <code>refresh()</code> method to apply the sort criteria.
+ *
+ *  <p>Typically the sort is defined for collections of complex items, that is
+ *  collections in which the sort is performed on one or more properties of 
+ *  the objects in the collection.
+ *  The following example shows this use:</p>
+ *  <pre><code>
+ *     var col:ICollectionView = new ArrayCollection();
+ *     // In the real world, the collection would have more than one item.
+ *     col.addItem({first:"Anders", last:"Dickerson"});
+ *
+ *     // Create the Sort instance.
+ *     var sort:ISort = new Sort();
+ *
+ *     // Set the sort field; sort on the last name first, first name second.
+ *     // Both fields are case-insensitive.
+ *     sort.fields = [new SortField("last",true), new SortField("first",true)];
+ *       // Assign the Sort object to the view.
+ *     col.sort = sort;
+ *
+ *     // Apply the sort to the collection.
+ *     col.refresh();
+ *  </code></pre>
+ *
+ *  <p>There are situations in which the collection contains simple items, 
+ *  like <code>String</code>, <code>Date</code>, <code>Boolean</code>, etc.
+ *  In this case, apply the sort to the simple type directly.
+ *  When constructing a sort for simple items, use a single sort field,
+ *  and specify a <code>null</code> <code>name</code> (first) parameter
+ *  in the SortField object constructor.
+ *  For example:
+ *  <pre><code>
+ *     var col:ICollectionView = new ArrayCollection();
+ *     col.addItem("California");
+ *     col.addItem("Arizona");
+ *     var sort:Sort = new Sort();
+ *
+ *     // There is only one sort field, so use a <code>null</code>
+ *     // first parameter.
+ *     sort.fields = [new SortField(null, true)];
+ *     col.sort = sort;
+ *     col.refresh();
+ *  </code></pre>
+ *  </p>
+ *
+ *  <p>The Flex implementations of the <code>ICollectionView</code> interface
+ *  retrieve all items from a remote location before executing a sort.
+ *  If you use paging with a sorted list, apply the sort to the remote
+ *  collection before you retrieve the data.
+ *  </p>
+ *
+ *  <p>By default this Sort class does not provide correct language specific
+ *  sorting for strings.  For this type of sorting please see the 
+ *  <code>spark.collections.Sort</code> and 
+ *  <code>spark.collections.SortField</code> classes.</p>
+ *
+ *  Note: to prevent problems like
+ *  <a href="https://issues.apache.org/jira/browse/FLEX-34853">FLEX-34853</a>
+ *  it is recommended to use SortField
+ *  instances as immutable objects (by not changing their state).
+ * 
+ *  @mxml
+ *
+ *  <p>The <code>&lt;mx:Sort&gt;</code> tag has the following attributes:</p>
+ *
+ *  <pre>
+ *  &lt;mx:Sort
+ *  <b>Properties</b>
+ *  compareFunction="<em>Internal compare function</em>"
+ *  fields="null"
+ *  unique="false | true"
+ *  /&gt;
+ *  </pre>
+ *
+ *  <p>In case items have inconsistent data types or items have complex data 
+ *  types, the use of the default built-in compare functions is not recommended.
+ *  Inconsistent sorting results may occur in such cases. To avoid such problem,
+ *  provide a custom compare function and/or make the item types consistent.</p>
+ *
+ *  <p>Just like any other <code>AdvancedStyleClient</code>-based classes, 
+ *  the <code>Sort</code> and <code>SortField</code> classes do not have a 
+ *  parent-child relationship in terms of event handling. Locale changes in a 
+ *  <code>Sort</code> instance are not dispatched to its <code>SortField</code> 
+ *  instances automatically. The only exceptional case is the internal default 
+ *  <code>SortField</code> instance used when no explicit fields are provided.
+ *  In this case, the internal default <code>SortField</code> instance follows 
+ *  the locale style that the owner <code>Sort</code> instance has.</p>
+ *
+ *  @see mx.collections.ICollectionView
+ *  @see ISortField
+ *  @see spark.collections.Sort
+ *  @see spark.collections.SortField
+ * 
+ *  @langversion 3.0
+ *  @playerversion Flash 9
+ *  @playerversion AIR 1.1
+ *  @productversion Royale 0.9.4
+ *  @royalesuppresspublicvarwarning
+ */
+public class Sort extends EventDispatcher implements ISort
+{
+  
+    //--------------------------------------------------------------------------
+    //
+    //  Constructor
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  Constructor.
+     *
+     *  <p>Creates a new Sort with no fields set and no custom comparator.</p>
+     *
+     *  @param fields An <code>Array</code> of <code>ISortField</code> objects that
+     *  specifies the fields to compare.
+     *  @param customCompareFunction Use a custom function to compare the
+     *  objects in the collection to which this sort will be applied.
+     *  @param unique Indicates if the sort should be unique.
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Royale 0.9.4
+     */
+    public function Sort(fields:Array = null, customCompareFunction:Function = null, unique:Boolean = false)
+    {
+        super();
+
+        this.fields = fields;
+       
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    //  Variables
+    //
+    //--------------------------------------------------------------------------
+
+
+    //----------------------------------
+    //  fields
+    //----------------------------------
+
+    /**
+     *  @private
+     *  Storage for the fields property.
+     */
+    private var _fields:Array;
+
+     [Inspectable(category="General", arrayType="mx.collections.ISortField")]
+    [Bindable("fieldsChanged")]
+ 
+    /**
+     *  @inheritDoc
+     *
+     *  @default null
+     *
+     *  @see SortField
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Royale 0.9.4
+     */
+    public function get fields():Array
+    {
+        return _fields;
+    }
+
+    /**
+     *  @private
+     */
+    public function set fields(value:Array):void
+    {
+        _fields = value;
+
+        dispatchEvent(new Event("fieldsChanged")); 
+    }
+
+}
+}
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/collections/SortField.as b/frameworks/projects/MXRoyale/src/main/royale/mx/collections/SortField.as
new file mode 100644
index 000000000..ad1e419a9
--- /dev/null
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/collections/SortField.as
@@ -0,0 +1,855 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+package mx.collections
+{
+
+
+/* 
+    import flash.events.Event;
+    import flash.events.EventDispatcher; */
+	
+	import org.apache.royale.events.Event;
+	import org.apache.royale.events.EventDispatcher;
+	
+  //  import mx.collections.errors.SortError;
+    import mx.core.mx_internal;
+/*     import mx.resources.IResourceManager; */ //commented
+
+  /*  import mx.resources.ResourceManager; */ //commented
+    import mx.utils.ObjectUtil;
+
+    [ResourceBundle("collections")]
+/* [Alternative(replacement="spark.collections.SortField", since="4.5")]
+ */
+/**
+ *  Provides the sorting information required to establish a sort on a field
+ *  or property in a collection view.
+ *
+ *  The SortField class is meant to be used with the Sort class.
+ *
+ *  Typically the sort is defined for collections of complex items, that is
+ *  items in which the sort is performed on properties of those objects.
+ *  As in the following example:
+ *
+ *  <pre><code>
+ *     var col:ICollectionView = new ArrayCollection();
+ *     col.addItem({first:"Anders", last:"Dickerson"});
+ *     var sort:Sort = new Sort();
+ *     sort.fields = [new SortField("first", true)];
+ *     col.sort = sort;
+ *  </code></pre>
+ *
+ *  There are situations in which the collection contains simple items, like
+ *  <code>String</code>, <code>Date</code>, <code>Boolean</code>, etc.
+ *  In this case, sorting should be applied to the simple type directly.
+ *  When constructing a sort for this situation only a single sort field is
+ *  required and should not have a <code>name</code> specified.
+ *  For example:
+ *
+ *  <pre><code>
+ *     var col:ICollectionView = new ArrayCollection();
+ *     col.addItem("California");
+ *     col.addItem("Arizona");
+ *     var sort:Sort = new Sort();
+ *     sort.fields = [new SortField(null, true)];
+ *     col.sort = sort;
+ *  </code></pre>
+ *
+ *  <p>By default the comparison provided by the SortField class does
+ *  not provide correct language specific
+ *  sorting for strings.  For this type of sorting please see the
+ *  <code>spark.collections.Sort</code> and
+ *  <code>spark.collections.SortField</code> classes.</p>
+ *
+ *  Note: to prevent problems like
+ *  <a href="https://issues.apache.org/jira/browse/FLEX-34853">FLEX-34853</a>
+ *  it is recommended to use SortField
+ *  instances as immutable objects (by not changing their state).
+ *
+ *  @mxml
+ *
+ *  <p>The <code>&lt;mx:SortField&gt;</code> tag has the following attributes:</p>
+ *
+ *  <pre>
+ *  &lt;mx:SortField
+ *  <b>Properties</b>
+ *  caseInsensitive="false"
+ *  compareFunction="<em>Internal compare function</em>"
+ *  descending="false"
+ *  name="null"
+ *  numeric="null"
+ *  /&gt;
+ *  </pre>
+ *
+ *  @see mx.collections.ICollectionView
+ *  @see mx.collections.Sort
+ *  @see spark.collections.Sort
+ *  @see spark.collections.SortField
+
+ *  @langversion 3.0
+ *  @playerversion Flash 9
+ *  @playerversion AIR 1.1
+ *  @productversion Royale 0.9.4
+ */
+public class SortField extends EventDispatcher implements ISortField
+{
+  /*   include "../core/Version.as"; */
+
+    //--------------------------------------------------------------------------
+    //
+    //  Constructor
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  Constructor.
+     *
+     *  @param name The name of the property that this field uses for
+     *              comparison.
+     *              If the object is a simple type, pass <code>null</code>.
+     *  @param caseInsensitive When sorting strings, tells the comparator
+     *              whether to ignore the case of the values.
+     *  @param descending Tells the comparator whether to arrange items in
+     *              descending order.
+     *  @param numeric Tells the comparator whether to compare sort items as
+     *              numbers, instead of alphabetically.
+     *  @param sortCompareType Gives an indication to SortField which of the
+     *              default compare functions to use.
+     *  @param customCompareFunction Use a custom function to compare the
+     *              objects based on this SortField.
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Royale 0.9.4
+     */
+    public function SortField(name:String = null,
+                              caseInsensitive:Boolean = false,
+                              descending:Boolean = false,
+                              numeric:Object = null,
+                              sortCompareType:String = null,
+                              customCompareFunction:Function = null)
+    {
+        super();
+
+        _name = name;
+        _caseInsensitive = caseInsensitive;
+       // _descending = descending;
+        _numeric = numeric;
+       // _sortCompareType = sortCompareType;
+
+        /* if(customCompareFunction != null)
+        {
+            compareFunction = customCompareFunction;
+        }
+        else if (updateSortCompareType() == false)
+        {
+            _compareFunction = stringCompare;
+        } */
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    //  Variables
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  @private
+     *  Used for accessing localized Error messages.
+     */
+   /*  private var resourceManager:IResourceManager =
+                                    ResourceManager.getInstance(); */
+
+    //--------------------------------------------------------------------------
+    //
+    //  Properties
+    //
+    //--------------------------------------------------------------------------
+
+    //---------------------------------
+    //  arraySortOnOptions
+    //---------------------------------
+
+    /**
+    *  @inheritDoc
+    *
+    *  @langversion 3.0
+    *  @playerversion Flash 9
+    *  @playerversion AIR 1.1
+    *  @productversion Royale 0.9.4
+    */
+    /* public function get arraySortOnOptions():int
+    {
+        if (usingCustomCompareFunction
+            || name == null
+            || _compareFunction == xmlCompare
+            || _compareFunction == dateCompare)
+        {
+            return -1;
+        }
+        var options:int = 0;
+        if (caseInsensitive) options |= Array.CASEINSENSITIVE;
+        if (descending) options |= Array.DESCENDING;
+        if (numeric == true || _compareFunction == numericCompare) options |= Array.NUMERIC;
+        return options;
+    } */
+
+    //---------------------------------
+    //  caseInsensitive
+    //---------------------------------
+
+    /**
+     *  @private
+     *  Storage for the caseInsensitive property.
+     */
+    private var _caseInsensitive:Boolean;
+
+    [Inspectable(category="General")]
+    [Bindable("caseInsensitiveChanged")]
+
+    /**
+     *  Specifies whether the sort for this field should be case insensitive.
+     *
+     *  @default false
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Royale 0.9.4
+     */
+    public function get caseInsensitive():Boolean
+    {
+        return _caseInsensitive;
+    }
+
+    /**
+     *  @deprecated A future release of Apache Flex SDK will remove this function. Please use the constructor
+     *  argument instead.
+     */
+    mx_internal function setCaseInsensitive(value:Boolean):void
+    {
+        if (value != _caseInsensitive)
+        {
+            _caseInsensitive = value;
+            dispatchEvent(new Event("caseInsensitiveChanged"));
+        }
+    }
+
+    //---------------------------------
+    //  compareFunction
+    //---------------------------------
+
+    /**
+     *  @private
+     *  Storage for the compareFunction property.
+     */
+    /* private var _compareFunction:Function;
+
+    [Inspectable(category="General")] */
+
+    /**
+     *  The function that compares two items during a sort of items for the
+     *  associated collection. If you specify a <code>compareFunction</code>
+     *  property in an <code>ISort</code> object, Flex ignores any
+     *  <code>compareFunction</code> properties of the ISort's
+     *  <code>SortField</code> objects.
+     *
+     *  <p>The compare function must have the following signature:</p>
+     *
+     *  <p><code>function myCompare(a:Object, b:Object):int</code></p>
+     *
+     *  <p>This function must return the following values:</p>
+     *
+     *   <ul>
+     *        <li>-1, if the <code>Object a</code> should appear before the
+     *        <code>Object b</code> in the sorted sequence</li>
+     *        <li>0, if the <code>Object a</code> equals the
+     *        <code>Object b</code></li>
+     *        <li>1, if the <code>Object a</code> should appear after the
+     *        <code>Object b</code> in the sorted sequence</li>
+     *  </ul>
+     *
+     *  <p>The default value is an internal compare function that can perform
+     *  a string, numeric, or date comparison in ascending or descending order,
+     *  with case-sensitive or case-insensitive string comparisons.
+     *  Specify your own function only if you need a need a custom comparison
+     *  algorithm. This is normally only the case if a calculated field is
+     *  used in a display.</p>
+     *
+     *  Note if you need language-specific sorting then consider using the
+     *  <code>spark.collections.SortField</code> class.
+     *
+     *  @see spark.collections.SortField
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Royale 0.9.4
+     */
+    /* public function get compareFunction():Function
+    {
+        return _compareFunction;
+    } */
+
+    /**
+     *  @deprecated A future release of Apache Flex SDK will remove this function. Please use the constructor
+     *  argument instead.
+     */
+   /*  public function set compareFunction(c:Function):void
+    {
+        _compareFunction = c;
+        _usingCustomCompareFunction = (c != null);
+    } */
+
+    //---------------------------------
+    //  descending
+    //---------------------------------
+
+    /**
+     *  @private
+     *  Storage for the descending property.
+     */
+    /* private var _descending:Boolean;
+
+    [Inspectable(category="General")]
+    [Bindable("descendingChanged")] */
+
+    /**
+     *  @inheritDoc
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Royale 0.9.4
+     */
+    /* public function get descending():Boolean
+    {
+        return _descending;
+    } */
+
+    /**
+     *  @deprecated A future release of Apache Flex SDK will remove this function. Please use the constructor
+     *  argument instead.
+     */
+    /* public function set descending(value:Boolean):void
+    {
+        if (_descending != value)
+        {
+            _descending = value;
+            dispatchEvent(new Event("descendingChanged"));
+        }
+    } */
+
+    //---------------------------------
+    //  name
+    //---------------------------------
+
+    /**
+     *  @private
+     *  Storage for the name property.
+     */
+    private var _name:String;
+
+    [Inspectable(category="General")]
+    [Bindable("nameChanged")]
+
+    /**
+     *  @inheritDoc
+     *
+     *  @default null
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Royale 0.9.4
+     */
+    public function get name():String
+    {
+        return _name;
+    }
+
+    /**
+     *  @deprecated A future release of Apache Flex SDK will remove this function. Please use the constructor
+     *  argument instead.
+     */
+    public function set name(n:String):void
+    {
+        _name = n;
+        dispatchEvent(new Event("nameChanged"));
+    }
+
+    //---------------------------------
+    //  numeric
+    //---------------------------------
+
+    /**
+     *  @private
+     *  Storage for the numeric property.
+     */
+    private var _numeric:Object;
+
+    [Inspectable(category="General")]
+    [Bindable("numericChanged")]
+
+    /**
+     *  @inheritDoc
+     *
+     *  @default null
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Royale 0.9.4
+     */
+    public function get numeric():Object
+    {
+        return _numeric;
+    }
+
+    /**
+     *  @deprecated A future release of Apache Flex SDK will remove this function. Please use the constructor
+     *  argument instead.
+     */
+    public function set numeric(value:Object):void
+    {
+        if (_numeric != value)
+        {
+            _numeric = value;
+            dispatchEvent(new Event("numericChanged"));
+        }
+    }
+
+
+    //---------------------------------
+    //  sortCompareType
+    //---------------------------------
+
+    /**
+     *  @private
+     */
+   /*  private var _sortCompareType:String = null; */
+
+    /**
+     *  @inheritDoc
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 11.8
+     *  @playerversion AIR 3.8
+     *  @productversion Royale 0.9.4
+     */
+    /* [Bindable("sortCompareTypeChanged")]
+    public function get sortCompareType():String
+    {
+        return _sortCompareType;
+    } */
+
+    /**
+     *  @deprecated A future release of Apache Flex SDK will remove this function. Please use the constructor
+     *  argument instead.
+     */
+    /* public function set sortCompareType(value:String):void
+    {
+        if (_sortCompareType != value)
+        {
+            _sortCompareType = value;
+            dispatchEvent(new Event("sortCompareTypeChanged"));
+        }
+
+        updateSortCompareType();
+    } */
+
+
+    //---------------------------------
+    //  usingCustomCompareFunction
+    //---------------------------------
+
+    /* private var _usingCustomCompareFunction:Boolean; */
+
+    /**
+     *  @inheritDoc
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Royale 0.9.4
+     */
+   /*  public function get usingCustomCompareFunction():Boolean
+    {
+        return _usingCustomCompareFunction;
+    } */
+
+    //--------------------------------------------------------------------------
+    //
+    //  Overridden Methods
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  @private
+     *  A pretty printer for SortField that lists the sort fields and their
+     *  options.
+     */
+   /*  override public function toString():String
+    {
+        return "";
+    } */
+
+    //--------------------------------------------------------------------------
+    //
+    //  Methods
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  @inheritDoc
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Royale 0.9.4
+     */
+    /* public function initializeDefaultCompareFunction(obj:Object):void
+    {
+        // if the compare function is not already set then we can set it
+        if (!usingCustomCompareFunction)
+        {
+            if (_sortCompareType)
+            {
+                //Attempt to set the compare function based on the sortCompareType
+                if (updateSortCompareType() == true)
+                {
+                    return;
+                }
+            }
+
+            if (numeric == true)
+                _compareFunction = numericCompare;
+            else if (caseInsensitive || numeric == false)
+                _compareFunction = stringCompare;
+            else
+            {
+                // we need to introspect the data a little bit
+                var value:Object;
+                if (_name)
+                {
+                    value = getSortFieldValue(obj);
+                }
+                //this needs to be an == null check because !value will return true
+                //where value == 0 or value == false
+                if (value == null)
+                {
+                    value = obj;
+                }
+
+                var typ:String = typeof(value);
+                switch (typ)
+                {
+                    case "string":
+                        _compareFunction = stringCompare;
+                    break;
+                    case "object":
+                        if (value is Date)
+                        {
+                            _compareFunction = dateCompare;
+                        }
+                        else
+                        {
+                            _compareFunction = stringCompare;
+                            var test:String;
+                            try
+                            {
+                                test = value.toString();
+                            }
+                            catch(error2:Error)
+                            {
+                            }
+                            if (!test || test == "[object Object]")
+                            {
+                                _compareFunction = nullCompare;
+                            }
+                        }
+                    break;
+                    case "xml":
+                        _compareFunction = xmlCompare;
+                    break;
+                    case "boolean":
+                    case "number":
+                        _compareFunction = numericCompare;
+                    break;
+                }
+            }  // else
+        } // if
+    } */
+
+    /**
+     *  @inheritDoc
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Royale 0.9.4
+     */
+   /*  public function reverse():void
+    {
+        descending = !descending;
+    } */
+
+
+    /**
+     *  @inheritDoc
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 11.8
+     *  @playerversion AIR 3.8
+     *  @productversion Royale 0.9.4
+     */
+    /* public function updateSortCompareType():Boolean
+    {
+        if (!_sortCompareType)
+        {
+            return false;
+        }
+
+
+        //Lookup the sortCompareType by its SortFieldCompareTypes value and set the associated compare method.
+        switch(_sortCompareType)
+        {
+             case SortFieldCompareTypes.DATE:
+            {
+                _compareFunction = dateCompare;
+
+                return true;
+            }
+
+            case SortFieldCompareTypes.NULL:
+            {
+                _compareFunction = nullCompare;
+
+                return true;
+            }
+
+            case SortFieldCompareTypes.NUMERIC:
+            {
+                _compareFunction = numericCompare;
+
+                return true;
+            }
+
+            case SortFieldCompareTypes.STRING:
+            {
+                _compareFunction = stringCompare;
+
+                return true;
+            }
+
+            case SortFieldCompareTypes.XML:
+            {
+                _compareFunction = xmlCompare;
+
+                return true;
+            } 
+        }
+
+
+        return false;
+    }
+
+
+    public function objectHasSortField(object:Object):Boolean
+    {
+        return getSortFieldValue(object) !== undefined;
+    } */
+
+
+    //--------------------------------------------------------------------------
+    //
+    //  Protected Methods
+    //
+    //--------------------------------------------------------------------------
+
+    /* protected function getSortFieldValue(obj:Object):*
+    {
+        var result:* = undefined;
+
+        try
+        {
+            result = obj[_name];
+        }
+        catch(error:Error)
+        {
+        }
+
+        return result;
+    } */
+
+    //--------------------------------------------------------------------------
+    //
+    //  Private Methods
+    //
+    //--------------------------------------------------------------------------
+
+    /* private function nullCompare(a:Object, b:Object):int
+    {
+        var left:Object;
+        var right:Object;
+
+        var found:Boolean = false;
+
+        // return 0 (ie equal) if both are null
+        if (a == null && b == null)
+        {
+            return 0;
+        }
+
+        // we need to introspect the data a little bit
+        if (_name)
+        {
+            left = getSortFieldValue(a);
+            right = getSortFieldValue(b);
+        }
+
+        // return 0 (ie equal) if both are null
+        if (left == null && right == null)
+            return 0;
+
+        if (left == null && !_name)
+            left = a;
+
+        if (right == null && !_name)
+            right = b;
+
+
+        var typeLeft:String = typeof(left);
+        var typeRight:String = typeof(right);
+
+
+        if (typeLeft == "string" || typeRight == "string")
+        {
+                found = true;
+                _compareFunction = stringCompare;
+        }
+        else if (typeLeft == "object" || typeRight == "object")
+        {
+            if (left is Date || right is Date)
+            {
+                found = true;
+                _compareFunction = dateCompare;
+            }
+        }
+        else if (typeLeft == "xml" || typeRight == "xml")
+        {
+                found = true;
+                _compareFunction = xmlCompare;
+        }
+        else if (typeLeft == "number" || typeRight == "number"
+                 || typeLeft == "boolean" || typeRight == "boolean")
+        {
+                found = true;
+                _compareFunction = numericCompare;
+        }
+
+        if (found)
+        {
+            return _compareFunction(left, right);
+        }
+        else
+        {
+            var message:String = "";
+			 resourceManager.getString(
+                "collections", "noComparatorSortField", [ name ]); 
+            throw new SortError(message);
+        }
+    } */
+
+    /**
+     *  Pull the numbers from the objects and call the implementation.
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Royale 0.9.4
+     */
+   /*  private function numericCompare(a:Object, b:Object):int
+    {
+        var fa:Number = _name == null ? Number(a) : Number(getSortFieldValue(a));
+        var fb:Number = _name == null ? Number(b) : Number(getSortFieldValue(b));
+
+        return ObjectUtil.numericCompare(fa, fb);
+    } */
+
+    /**
+     *  Pull the date objects from the values and compare them.
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Royale 0.9.4
+     */
+    /* private function dateCompare(a:Object, b:Object):int
+    {
+        var fa:Date = _name == null ? a as Date : getSortFieldValue(a) as Date;
+        var fb:Date = _name == null ? b as Date : getSortFieldValue(b) as Date;
+
+        return ObjectUtil.dateCompare(fa, fb);
+    } */
+
+    /**
+     *  Pull the strings from the objects and call the implementation.
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Royale 0.9.4
+     */
+    /* protected function stringCompare(a:Object, b:Object):int
+    {
+        var fa:String = _name == null ? String(a) : String(getSortFieldValue(a));
+        var fb:String = _name == null ? String(b) : String(getSortFieldValue(b));
+
+        return ObjectUtil.stringCompare(fa, fb, _caseInsensitive);
+    } */
+
+    /**
+     *  Pull the values out fo the XML object, then compare
+     *  using the string or numeric comparator depending
+     *  on the numeric flag.
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Royale 0.9.4
+     */
+    /* protected function xmlCompare(a:Object, b:Object):int
+    {
+        var sa:String = _name == null ? a.toString() : getSortFieldValue(a).toString();
+        var sb:String = _name == null ? b.toString() : getSortFieldValue(b).toString();
+
+        if (numeric == true)
+        {
+            return ObjectUtil.numericCompare(parseFloat(sa), parseFloat(sb));
+        }
+        else
+        {
+            return ObjectUtil.stringCompare(sa, sb, _caseInsensitive);
+        }
+    } */
+}
+}
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/collections/error/SortError.as b/frameworks/projects/MXRoyale/src/main/royale/mx/collections/error/SortError.as
new file mode 100644
index 000000000..fd82dc8c6
--- /dev/null
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/collections/error/SortError.as
@@ -0,0 +1,58 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+package mx.collections.errors
+{
+
+/**
+ *  This error is thrown when a Sort class is not configured properly;
+ *  for example, if the find criteria are invalid.
+ *  
+ *  @langversion 3.0
+ *  @playerversion Flash 9
+ *  @playerversion AIR 1.1
+ *  @productversion Flex 3
+ */
+public class SortError extends Error
+{
+    /* include "../../core/Version.as"; */
+
+    //--------------------------------------------------------------------------
+    //
+    //  Constructor
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  Constructor.
+	 *
+	 *  @param message A message providing information about the error cause.
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public function SortError(message:String)
+    {
+        super(message);
+    }
+}
+
+}


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services