com.jamonapi.utils
Class DateMathComparator
java.lang.Object
com.jamonapi.utils.JAMonComparator
com.jamonapi.utils.DateMathComparator
- All Implemented Interfaces:
- java.util.Comparator
public class DateMathComparator
- extends JAMonComparator
Comparator that allows you to pass Calendar fields and a negative number for the number
of this filed (i.e. hours/days) that a Date should not exceed. Use fields like Calendar.DATE, HOUR_OF_DAY, DAY_OF_MONTH, DAY_OF_WEEK, DAY_OF_YEAR ETC.
Values to be used for dateToAdd in the constructor could be -7 for 7 days ago, or -24 for 24 hours ago depending on what
was passed in the dateField.
Method Summary |
protected int |
compareThis(java.lang.Object o1,
java.lang.Object o2)
2 dates are equal if they are both above or below the Calendar field threshold
date1 is greater if it is greater than threshold and date2 isn't
date1 is less than the threshold than it is greater than date2. |
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 |
DateMathComparator
public DateMathComparator(int dateField,
int dateToAdd)
compareThis
protected int compareThis(java.lang.Object o1,
java.lang.Object o2)
- 2 dates are equal if they are both above or below the Calendar field threshold
- date1 is greater if it is greater than threshold and date2 isn't
- date1 is less than the threshold than it is greater than date2.
- Overrides:
compareThis
in class JAMonComparator