org.locomotive.util.data
Class DateKey
java.lang.Object
|
+--org.locomotive.util.data.DateKey
- public class DateKey
- extends java.lang.Object
- implements ComparisonKey
this class provides a comparison key for dates with times.
Field Summary |
java.util.Date |
date
|
Constructor Summary |
DateKey(java.util.Date date)
Constructor creates a new DateKey from a date |
Method Summary |
int |
compare(ComparisonKey otherKey)
Compare myself to another object |
java.lang.String |
toString()
returns a string representation of the DateKey |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
date
public java.util.Date date
DateKey
public DateKey(java.util.Date date)
- Constructor creates a new DateKey from a date
- Parameters:
date
- the date to be used
compare
public int compare(ComparisonKey otherKey)
throws ComparisonKeyException
- Compare myself to another object
- Specified by:
- compare in interface ComparisonKey
- Parameters:
key
- - the key to which this object is to be
compared- Returns:
- -1 - if this dateKey comes before otherKey
1 - if this this dateKey comes after otherKey
0 - if this dateKey is equivalent to otherKey - Throws:
- ComparisonKeyException -
if otherKey cannot be compared with this object
toString
public java.lang.String toString()
- returns a string representation of the DateKey
- Specified by:
- toString in interface ComparisonKey
- Overrides:
- toString in class java.lang.Object