| Package | vegas.util.comparators |
| Class | public class DateComparator |
| Inheritance | DateComparator CoreObject |
| Implements | ICloneable, IComparator, ICopyable |
Example :
import vegas.util.comparators.DateComparator; var comp:DateComparator = new DateComparator() ; var d1:Date = new Date(2007, 1, 1) ; var d2:Number = 1170284400000 ; var d3:Date = new Date(2007, 2, 2) ; var d4:Number = 1172790000000 ; trace( comp.compare(d1, d1) ) ; // 0 trace( comp.compare(d1, d2) ) ; // 0 trace( comp.compare(d2, d1) ) ; // 0 trace( comp.compare(d1, d3) ) ; // -1 trace( comp.compare(d1, d4) ) ; // -1 trace( comp.compare(d3, d1) ) ; // 1 trace( comp.compare(d4, d1) ) ; // 1
| Method | Defined by | ||
|---|---|---|---|
|
Creates a new DateComparator instance.
| DateComparator | ||
|
clone():*
Creates and returns a shallow copy of the object.
| DateComparator | ||
|
compare(o1:*, o2:*):int
Returns an integer value to compare two Date objects.
| DateComparator | ||
|
copy():*
Creates and returns a deep copy of the object.
| DateComparator | ||
|
[static]
Returns the singleton instance of a DateComparator.
| DateComparator | ||
![]() |
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 | |
| DateComparator | () | constructor |
public function DateComparator()Creates a new DateComparator 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 Date objects.
Parameterso1:* — the first Date object to compare.
|
|
o2:* — the second Date object to compare.
|
int —
|
— if compare(a, b) and 'a' and 'b' must be Date or uint 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():DateComparatorReturns the singleton instance of a DateComparator. 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.
ReturnsDateComparator —
the singleton instance of a DateComparator.
|