|
Copyright © 2005 Scientific Applications. All Rights Reserved. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sciapp.comparators.DateComparator
public class DateComparator
This class is used to compare two Date objects.
DateComparator makes use of two calendar objects for the comparisons, each initialized to the Date objects being compared.
Field Summary | |
---|---|
protected Calendar |
calendar1
a calendar object that is used in the compare method |
protected Calendar |
calendar2
a calendar object that is used in the compare method |
protected boolean |
ignoreTime
flag to indicate if the date comparator will ignore time differences |
Constructor Summary | |
---|---|
DateComparator()
Constructs a DateComparator object that will ignore time differences. |
|
DateComparator(boolean ignoreTime)
Constructs a DateComparator object that will ignore time differences if ignoreTime is true. |
Method Summary | |
---|---|
int |
compare(Object o1,
Object o2)
Compares its two arguments for order as defined by compare of the
Comparator interface. |
boolean |
getIgnoreTime()
Returns a boolean which is true if the date comparator is set to ignore time differences. |
void |
setIgnoreTime(boolean ignoreTime)
Set whether time differences are to be ignored or not. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface java.util.Comparator |
---|
equals |
Field Detail |
---|
protected boolean ignoreTime
protected Calendar calendar1
protected Calendar calendar2
Constructor Detail |
---|
public DateComparator()
public DateComparator(boolean ignoreTime)
Method Detail |
---|
public int compare(Object o1, Object o2)
compare
of the
Comparator
interface. o1
and o2
must be
Date objects, otherwise this method throws a ClassCastException.
If the ignoreTime flag is false, this method will compare only the year, month and date fields of the date objects supplied.
compare
in interface Comparator
o1
- the first object to be compared.o2
- the second object to be compared.
o1
is less than, equal to, or greater than o2
accordingly.public boolean getIgnoreTime()
public void setIgnoreTime(boolean ignoreTime)
ignoreTime
- the ignore time flag
|
Copyright © 2005 Scientific Applications. All Rights Reserved. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |