| Package | vegas.util.comparators |
| Class | public class BooleanComparator |
| Inheritance | BooleanComparator CoreObject |
| Implements | ICloneable, IComparator, ICopyable |
Boolean objects that can sort either true or false first.
Example :
var c:IComparator = 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 | ||
|
clone():*
Creates and returns a shallow copy of the object.
| BooleanComparator | ||
|
compare(o1:*, o2:*):int
Returns an integer value to compare two Boolean objects.
| BooleanComparator | ||
|
copy():*
Creates and returns a deep copy of the object.
| BooleanComparator | ||
|
[static]
Returns a
BooleanComparator singleton that sorts false values before true values. | BooleanComparator | ||
![]() |
Returns the internal
ILogger reference of this ILogable object. | CoreObject | |
|
[static]
Returns a
BooleanComparator singleton that sorts true values before false values. | BooleanComparator | ||
![]() |
hashCode():uint
Returns a hashcode value for the object.
| CoreObject | |
![]() |
Sets the internal
ILogger reference of this ILogable object. | CoreObject | |
![]() |
toSource(indent:int = 0):String
Returns the string representation the source code of the object.
| CoreObject | |
![]() |
toString():String
Returns the string representation of this instance.
| CoreObject | |
| 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
|
| clone | () | method |
public function clone():*Creates and returns a shallow copy of the object.
Returns* — A new object that is a shallow copy of this instance.
|
| compare | () | method |
public function compare(o1:*, o2:*):intReturns an integer value to compare two Boolean objects.
Parameterso1:* — the first Number object to compare.
|
|
o2:* — the second Number object to compare.
|
int —
|
— if the first argument is null and not a Boolean object.
|
|
— when either argument is not Boolean
|
| copy | () | method |
public function copy():*Creates and returns a deep copy of the object.
Returns* — A new object that is a deep copy of this instance.
|
| getFalseFirstComparator | () | method |
public static function getFalseFirstComparator():BooleanComparator
Returns a BooleanComparator singleton that sorts false values before true values.
Clients are encouraged to use the value returned from this method instead of constructing a new instance to reduce allocation and garbage collection overhead when multiple BooleanComparators may be used in the same application.
Example :
var c:IComparator = BooleanComparator.getFalseFirstComparator() ;
trace(c.compare(true, true)) ; // 0
trace(c.compare(true, false)) ; // -1
trace(c.compare(false, true)) ; // 1
trace(c.compare(false, false)) ; // 0
Returns
BooleanComparator —
a BooleanComparator instance that sorts false values before true values.
|
| getTrueFirstComparator | () | method |
public static function getTrueFirstComparator():BooleanComparator
Returns a BooleanComparator singleton that sorts true values before false values.
Clients are encouraged to use the value returned from this method instead of constructing a new instance to reduce allocation and garbage collection overhead when multiple BooleanComparators may be used in the same application.
var c:IComparator = BooleanComparator.getTrueFirstComparator() ;
trace(c.compare(true, true)) ; // 0
trace(c.compare(true, false)) ; // 1
trace(c.compare(false, true)) ; // -1
trace(c.compare(false, false)) ; // 0
Returns
BooleanComparator —
a BooleanComparator instance that sorts true values before false values.
|