| java.lang.Object org.joda.time.DateTimeComparator
DateTimeComparator | public class DateTimeComparator implements Comparator,Serializable(Code) | | DateTimeComparator provides comparators to compare one date with another.
Dates may be specified using any object recognised by the
org.joda.time.convert.ConverterManager ConverterManager class.
The default objects recognised by the comparator are:
- ReadableInstant
- String
- Calendar
- Date
- Long (milliseconds)
- null (now)
DateTimeComparator is thread-safe and immutable.
author: Guy Allard author: Stephen Colebourne author: Brian S O'Neill since: 1.0 |
DateTimeComparator | protected DateTimeComparator(DateTimeFieldType lowerLimit, DateTimeFieldType upperLimit)(Code) | | Restricted constructor.
Parameters: lowerLimit - the lower field limit, null means no limit Parameters: upperLimit - the upper field limit, null means no limit |
compare | public int compare(Object lhsObj, Object rhsObj)(Code) | | Compare two objects against only the range of date time fields as
specified in the constructor.
Parameters: lhsObj - the first object,logically on the left of a < comparison, null means now Parameters: rhsObj - the second object,logically on the right of a < comparison, null means now zero if order does not matter,negative value if lhsObj < rhsObj, positive value otherwise. throws: IllegalArgumentException - if either argument is not supported |
equals | public boolean equals(Object object)(Code) | | Compares this comparator to another.
Parameters: object - the object to compare to true if equal |
getDateOnlyInstance | public static DateTimeComparator getDateOnlyInstance()(Code) | | Returns a comparator that only considers date fields.
Time of day is ignored.
a comparator over all date fields |
getInstance | public static DateTimeComparator getInstance()(Code) | | Returns a DateTimeComparator the compares the entire date time value.
a comparator over all fields |
getInstance | public static DateTimeComparator getInstance(DateTimeFieldType lowerLimit)(Code) | | Returns a DateTimeComparator with a lower limit only. Fields of a
magnitude less than the lower limit are excluded from comparisons.
Parameters: lowerLimit - inclusive lower limit for fields to be compared, null means no limit a comparator over all fields above the lower limit |
getInstance | public static DateTimeComparator getInstance(DateTimeFieldType lowerLimit, DateTimeFieldType upperLimit)(Code) | | Returns a DateTimeComparator with a lower and upper limit. Fields of a
magnitude less than the lower limit are excluded from comparisons.
Fields of a magnitude greater than or equal to the upper limit are also
excluded from comparisons. Either limit may be specified as null, which
indicates an unbounded limit.
Parameters: lowerLimit - inclusive lower limit for fields to be compared, null means no limit Parameters: upperLimit - exclusive upper limit for fields to be compared, null means no limit a comparator over all fields between the limits |
getLowerLimit | public DateTimeFieldType getLowerLimit()(Code) | | Gets the field type that represents the lower limit of comparison.
the field type, null if no upper limit |
getTimeOnlyInstance | public static DateTimeComparator getTimeOnlyInstance()(Code) | | Returns a comparator that only considers time fields.
Date is ignored.
a comparator over all time fields |
getUpperLimit | public DateTimeFieldType getUpperLimit()(Code) | | Gets the field type that represents the upper limit of comparison.
the field type, null if no upper limit |
hashCode | public int hashCode()(Code) | | Gets a suitable hashcode.
the hashcode |
toString | public String toString()(Code) | | Gets a debugging string.
a debugging string |
|
|