Packageorg.as3coreaddendum.system.comparators
Classpublic class BooleanComparator
InheritanceBooleanComparator Inheritance Object
Implements IComparator

A comparator for Boolean objects.

View the examples



Public Properties
 PropertyDefined By
  comparison : BooleanComparison
Defines the type of comparison to be used.
BooleanComparator
Public Methods
 MethodDefined By
  
Constructor, creates a new BooleanComparator object.
BooleanComparator
  
compare(o1:*, o2:*):int
Performs the comparison between the two arguments.
BooleanComparator
  
toString():String
Returns the string representation of this object.
BooleanComparator
Property Detail
comparisonproperty
comparison:BooleanComparison

Defines the type of comparison to be used.


Implementation
    public function get comparison():BooleanComparison
    public function set comparison(value:BooleanComparison):void

Throws
ArgumentError — If is assigned a null value.

See also

Constructor Detail
BooleanComparator()Constructor
public function BooleanComparator(comparison:BooleanComparison)

Constructor, creates a new BooleanComparator object.

Parameters
comparison:BooleanComparison — Indicates which type of comparison will be used.

Throws
ArgumentError — If the 'comparison' argument is null.

See also

Method Detail
compare()method
public function compare(o1:*, o2:*):int

Performs the comparison between the two arguments.

Parameters

o1:* — The first Boolean object to be compared.
 
o2:* — The second Boolean object to be compared.

Returns
int — A negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.

Throws
ArgumentError — if any of the arguments are not of type Boolean.
toString()method 
public function toString():String

Returns the string representation of this object.

Returns
String — the string representation of the this object.
Examples
     import org.as3coreaddendum.system.comparators.BooleanComparator;
     
     var b1:BooleanComparator = new BooleanComparator(BooleanComparison.TRUE_FIRST);
     
     b1.compare(true, false);    // -1
     b1.compare(false, true);    // 1
     
     var b2:BooleanComparator = new BooleanComparator(BooleanComparison.FALSE_FIRST);
     
     b2.compare(true, false);    // 1
     b2.compare(false, true);    // -1