| Package | flare.util |
| Class | public class Sort |
$() method for creating sorting
comparison functions from sort criteria. Instances of this class can be
used to encapsulate a set of sort criteria and retrieve a corresponding
sorting function.
Sort criteria are generally expressed as an array of property names
to sort on. These properties are accessed by sorting functions using the
Property class. Sort criteria are expressed as an
array of property names to sort on. These properties are accessed
by sorting functions using the Property class.
The default is to sort in ascending order. If the field name
includes a "-" (negative sign) prefix, that variable will instead
be sorted in descending order.
| Property | Defined by | ||
|---|---|---|---|
| comparator : Function [read-only] Gets the sorting comparison function for this Sort instance.
| Sort | ||
| criteria : Array The sorting criteria.
| Sort | ||
| Method | Defined by | ||
|---|---|---|---|
|
Sort(crit:*)
Creates a new Sort instance to encapsulate sorting criteria.
| Sort | ||
|
$(... a):Function
[static]
Creates a comparator function using the specification given
by the input arguments.
| Sort | ||
|
defaultComparator(a:*, b:*):int
[static]
Default comparator function that compares two values based on blind
application of the less-than and greater-than operators.
| Sort | ||
|
sort(list:Array):void
Sorts the input array according to the sort criteria.
| Sort | ||
| Constant | Defined by | ||
|---|---|---|---|
| ASC : Number [static] Prefix indicating an ascending sort order.
| Sort | ||
| DSC : Number [static] Prefix indicating a descending sort order.
| Sort | ||
| comparator | property |
comparator:Function [read-only]Gets the sorting comparison function for this Sort instance.
Implementation public function get comparator():Function
| criteria | property |
criteria:Array [read-write] The sorting criteria. Sort criteria are expressed as an
array of property names to sort on. These properties are accessed
by sorting functions using the Property class.
The default is to sort in ascending order. If the field name
includes a "-" (negative sign) prefix, that variable will instead
be sorted in descending order.
public function get criteria():Array
public function set criteria(value:Array):void
| Sort | () | constructor |
public function Sort(crit:*)Creates a new Sort instance to encapsulate sorting criteria.
Parameterscrit:* — the sorting criteria. Sort criteria are expressed as an
array of property names to sort on. These properties are accessed
by sorting functions using the Property class.
The default is to sort in ascending order. If the field name
includes a "-" (negative sign) prefix, that variable will instead
be sorted in descending order.
|
| $ | () | method |
public static function $(... a):FunctionCreates a comparator function using the specification given by the input arguments. The resulting sorting function can be used to sort objects based on their properties.
Parameters... a — A multi-parameter list or a single array containing a set
of data field names to sort on, in priority order. The default is
to sort in ascending order. If the field name includes a "-"
(negative sign) prefix, that variable will instead be sorted in
descending order.
|
Function — a comparison function for use in sorting objects.
|
| defaultComparator | () | method |
public static function defaultComparator(a:*, b:*):intDefault comparator function that compares two values based on blind application of the less-than and greater-than operators.
Parametersa:* — the first value to compare
|
|
b:* — the second value to compare
|
int — -1 if a < b, 1 if a > b, 0 otherwise.
|
| sort | () | method |
public function sort(list:Array):voidSorts the input array according to the sort criteria.
Parameterslist:Array — an array to sort
|
| ASC | constant |
public static const ASC:NumberPrefix indicating an ascending sort order.
| DSC | constant |
public static const DSC:NumberPrefix indicating a descending sort order.