| Package | system.comparators |
| Class | public class BooleanComparator |
| Inheritance | BooleanComparator Object |
| Implements | Comparator |
Boolean objects that can sort either true or false first.
Example :
import system.Comparator ;
import system.comparators.BooleanComparator ;
var c:Comparator = new BooleanComparator() ;
trace(c.compare(true, true)) ; // 0
trace(c.compare(true, false)) ; // 1
trace(c.compare(false, true)) ; // -1
trace(c.compare(false, false)) ; // 0
| Property | Defined By | ||
|---|---|---|---|
| trueFirst : Boolean
When true sort true boolean values before false. | BooleanComparator | ||
| Method | Defined By | ||
|---|---|---|---|
BooleanComparator(trueFirst:Boolean = true)
Creates a BooleanComparator that sorts trueFirst values before !trueFirst values. | BooleanComparator | ||
compare(o1:*, o2:*, options:* = null):int
Returns an integer value to compare two Boolean objects. | BooleanComparator | ||
| Constant | Defined By | ||
|---|---|---|---|
| falseFirst : BooleanComparator [static]
This BooleanComparator singleton that sorts false values before true values. | BooleanComparator | ||
| trueFirst : BooleanComparator [static]
This BooleanComparator singleton that sorts true values before false values. | BooleanComparator | ||
| trueFirst | property |
public var trueFirst:Boolean
When true sort true boolean values before false.
| BooleanComparator | () | Constructor |
public function BooleanComparator(trueFirst:Boolean = true)Creates a BooleanComparator that sorts trueFirst values before !trueFirst values. Please use the static factories instead whenever possible.
ParameterstrueFirst:Boolean (default = true) — when true, sort true boolean values before false
|
| compare | () | method |
public function compare(o1:*, o2:*, options:* = null):intReturns an integer value to compare two Boolean objects.
Parameters
o1:* — the first Number object to compare.
| |
o2:* — the second Number object to compare.
| |
options:* (default = null) |
int —
|
ArgumentError — if the first argument is null and not a Boolean object.
| |
ArgumentError — when either argument is not Boolean
|
| falseFirst | Constant |
public static const falseFirst:BooleanComparator
This BooleanComparator singleton that sorts false values before true values.
Clients are encouraged to use the value returned from this constant instead of constructing a new instance to reduce allocation and garbage collection overhead when multiple BooleanComparators may be used in the same application.
Example :
import system.comparators.BooleanComparator ;
import system.Comparator ;
var c:Comparator = BooleanComparator.falseFirst ;
trace( c.compare( true , true ) ) ; // 0
trace( c.compare( true , false ) ) ; // -1
trace( c.compare( false , true ) ) ; // 1
trace( c.compare( false , false ) ) ; // 0
| trueFirst | Constant |
public static const trueFirst:BooleanComparator
This BooleanComparator singleton that sorts true values before false values.
Clients are encouraged to use the value returned from this constant instead of constructing a new instance to reduce allocation and garbage collection overhead when multiple BooleanComparators may be used in the same application.
import system.comparators.BooleanComparator ;
import system.Comparator ;
var c:Comparator = BooleanComparator.trueFirst ;
trace( c.compare( true , true ) ) ; // 0
trace( c.compare( true , false ) ) ; // 1
trace( c.compare( false , true ) ) ; // -1
trace( c.compare( false , false ) ) ; // 0