| Package | vegas.util.comparators |
| Class | public class NumberComparator |
| Inheritance | NumberComparator CoreObject |
| Implements | ICloneable, IComparator, ICopyable |
Example :
import vegas.util.comparators.NumberComparator ; var c:NumberComparator = new NumberComparator() ; trace( c.compare(0,0) ) ; // 0 trace( c.compare(1,1) ) ; // 0 trace( c.compare(-1,-1) ) ; // 0 trace( c.compare(0.1,0.1) ) ; // 0 trace( c.compare( Number(Math.cos(25)) , 0.9912028118634736 ) ) ; // 0 trace( c.compare(1, 0) ) ; // 1 trace( c.compare(0, 1) ) ; // -1
| Method | Defined by | ||
|---|---|---|---|
|
Creates a new NumberComparator instance.
| NumberComparator | ||
|
clone():*
Creates and returns a shallow copy of the object.
| NumberComparator | ||
|
compare(o1:*, o2:*):int
Returns an integer value to compare two Number objects.
| NumberComparator | ||
|
copy():*
Creates and returns a deep copy of the object.
| NumberComparator | ||
|
[static]
Returns the singleton instance of a NumberComparator.
| NumberComparator | ||
![]() |
Returns the internal
ILogger reference of this ILogable object. | CoreObject | |
![]() |
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 | |
| NumberComparator | () | constructor |
public function NumberComparator()Creates a new NumberComparator instance.
| 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 Number objects.
Parameterso1:* — the first Number object to compare.
|
|
o2:* — the second Number object to compare.
|
int —
|
— if compare(a, b) and 'a' and 'b' must be Number objects.
|
| 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.
|
| getInstance | () | method |
public static function getInstance():NumberComparatorReturns the singleton instance of a NumberComparator. Developers are encouraged to use the comparator returned from this method instead of constructing a new instance to reduce allocation and GC overhead when multiple comparable comparators may be used in the same application.
ReturnsNumberComparator —
the singleton instance of a NumberComparator.
|