|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object | +--org.chronicj.DateRange
Defines basic requirements and utility methods for classes that model periods of time. Based directly on the Range pattern described by Martin Fowler. This is a value object.
TimePoint,
Range| Field Summary | |
static org.chronicj.DateRange |
EMTPY
Specifies an empty range which can be used as a constant |
| Constructor Summary | |
DateRange(java.util.Date aStartDate,
java.util.Date anEndDate)
Construct a DateRange using the given start and end dates. |
|
DateRange(org.chronicj.TimePoint aStartDate,
org.chronicj.TimePoint anEndDate)
Construct a DateRange using the supplied start and end TimePoints. |
|
| Method Summary | |
boolean |
abuts(org.chronicj.DateRange anotherRange)
Used to detect whether two date ranges abut each other. |
static org.chronicj.DateRange |
combination(org.chronicj.DateRange[] args)
|
int |
compareTo(java.lang.Object arg)
Compare the current DateRange instance to the one provided. |
org.chronicj.TimePoint |
end()
Accessor method for the TimePoint denoting the upper end
of this range. |
boolean |
equals(java.lang.Object arg)
|
org.chronicj.DateRange |
gap(org.chronicj.DateRange arg)
Used to determine the duration of time (expressed as another DateRange) between the current DateRange instance and another DateRange. |
org.chronicj.DatePrecision |
getDatePrecision()
The DatePrecisionof this range. |
int |
hashCode()
|
boolean |
includes(org.chronicj.DateRange arg)
Used to check whether a given DateRange occurs within the
current range. |
boolean |
includes(org.chronicj.TimePoint aDate)
Used to check whether a given TimePoint occurs within the
current range. |
static boolean |
isContiguous(org.chronicj.DateRange[] args)
|
boolean |
isEmpty()
Used mostly by other date range calculations to indicate an empty set. |
boolean |
overlaps(org.chronicj.DateRange anotherRange)
Used mostly by other date range calculations to indicate an empty set. |
boolean |
partitionedBy(org.chronicj.DateRange[] otherRanges)
Used to check whether a group of ranges completely partition the current DateRange. |
org.chronicj.TimePoint |
start()
Accessor method for the TimePoint denoting the lower end
of this range. |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final org.chronicj.DateRange EMTPY
| Constructor Detail |
public DateRange(java.util.Date aStartDate,
java.util.Date anEndDate)
Date arguments are wrapped using TimePoints, and as
such, they are normalized using minute precision (this is the default
precision for a TimePoint). If the start date is greater than the end
date, the range is considered empty. Currently, this class does not
support open ranges, i.e. since or until.
aStartDate - the Date that is the lower end of the rangeanEndDate - the Date that is the upper end of the range
java.lang.NullPointerException - is either argument is null
public DateRange(org.chronicj.TimePoint aStartDate,
org.chronicj.TimePoint anEndDate)
TimePoints.
If the start date is greater than the end date, the range is considered
empty. Currently, this class does not support open ranges, i.e. since or
until.
aStartDate - the TimePoint that is the lower end of the rangeanEndDate - the TimePoint that is the upper end of the range
java.lang.NullPointerException - is either argument is null| Method Detail |
public static boolean isContiguous(org.chronicj.DateRange[] args)
public org.chronicj.DatePrecision getDatePrecision()
DatePrecisionof this range. If the start and end of this
range are of different precisions, the greater precision is returned.
public boolean isEmpty()
public boolean abuts(org.chronicj.DateRange anotherRange)
anotherRange - the range to check against
public static org.chronicj.DateRange combination(org.chronicj.DateRange[] args)
public int compareTo(java.lang.Object arg)
start() is the greater valueend() is the greater value
compareTo in interface java.lang.Comparablearg - Object to compare
java.lang.ClassCastException - if argument is not a DateRange
java.lang.NullPointerException - if argument is nullpublic org.chronicj.TimePoint end()
TimePoint denoting the upper end
of this range.
public boolean equals(java.lang.Object arg)
equals in class java.lang.Objectpublic org.chronicj.DateRange gap(org.chronicj.DateRange arg)
DatePrecision.MINUTE, is used.
arg - the other DateRange against which to determine an intervening gap
public int hashCode()
hashCode in class java.lang.Objectpublic boolean includes(org.chronicj.TimePoint aDate)
TimePoint occurs within the
current range.
aDate - the TimePoint that is to be checked for occurence within the
current range
public boolean includes(org.chronicj.DateRange arg)
DateRange occurs within the
current range.
arg - the DateRange that is to be checked for occurence within the
current range
public boolean overlaps(org.chronicj.DateRange anotherRange)
anotherRange - the other DateRange against which to determine an intervening
gap
public boolean partitionedBy(org.chronicj.DateRange[] otherRanges)
otherRanges - the set of DateRange objects to check against
this
range, false otherwisepublic org.chronicj.TimePoint start()
TimePoint denoting the lower end
of this range.
public java.lang.String toString()
toString in class java.lang.Object
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||