Packageorg.as3coreaddendum.system
Interfacepublic interface ISortable

A class that implements this interface indicates that it can be sorted by the sort() method.

Usually the classes that implement this interface are collections of some sort.



Public Properties
 PropertyDefined By
  comparator : IComparator
Defines the IComparator object to be used in the comparison.
ISortable
  options : uint
Defines the options to be used automatically to sort.
ISortable
Public Methods
 MethodDefined By
  
sort(compare:Function = null, options:uint = 0):Array
Sorts the objects within this class.
ISortable
Property Detail
comparatorproperty
comparator:IComparator

Defines the IComparator object to be used in the comparison.


Implementation
    public function get comparator():IComparator
    public function set comparator(value:IComparator):void
optionsproperty 
options:uint

Defines the options to be used automatically to sort.


Implementation
    public function get options():uint
    public function set options(value:uint):void
Method Detail
sort()method
public function sort(compare:Function = null, options:uint = 0):Array

Sorts the objects within this class.

By default, Array.sort() works in the following way:

Parameters

compare:Function (default = null) — A comparison function used to determine the sorting order of elements in an array. For more info see IComparator.compare.
 
options:uint (default = 0) — One or more numbers or defined constants, separated by the | (bitwise OR) operator, that change the behavior of the sort from the default. The following values are acceptable for options:
  • 1 or Array.CASEINSENSITIVE
  • 2 or Array.DESCENDING
  • 4 or Array.UNIQUESORT
  • 8 or Array.RETURNINDEXEDARRAY
  • 16 or Array.NUMERIC

Returns
Array — The return value depends on whether you pass any arguments, as described in the following list:
  • If you specify a value of 4 or Array.UNIQUESORT for the options argument and two or more elements being sorted have identical sort fields, returns a value of 0 and does not modify the array.
  • If you specify a value of 8 or Array.RETURNINDEXEDARRAY for the options parameter, an array is returned that reflects the results of the sort and the array is not modified.
  • Otherwise, nothing is returned and the array is modified to reflect the sort order.

See also