Constructor and Description |
---|
DateRange(java.util.Date start,
java.util.Date end)
Constructs a date range between the specified start and end
dates (both inclusive).
|
Modifier and Type | Method and Description |
---|---|
java.util.Date |
getEnd()
Get the end date for this range
|
java.util.Date |
getStart()
Get the start date for this range
|
boolean |
inRange(java.util.Date d) |
static void |
main(java.lang.String[] args) |
boolean |
overlaps(DateRange dr) |
void |
setEnd(java.util.Date d)
Sets the end date for this range
|
void |
setStart(java.util.Date d)
Set the start date for this range
|
java.lang.String |
toString()
Output a string representation of the date range
|
isNegated, setNegated
public DateRange(java.util.Date start, java.util.Date end)
java.lang.IllegalArgumentException
- if the end date is lesser (via an compareTo
comparison) than the start date (equal to the start date
is ok)public java.util.Date getStart()
public java.util.Date getEnd()
public boolean inRange(java.util.Date d)
java.lang.IllegalArgumentException
- if the specified date was nullpublic boolean overlaps(DateRange dr)
java.lang.IllegalArgumentException
- if the specified date was nullpublic void setStart(java.util.Date d)
java.lang.NullPointerException
- if the specified date was nulljava.lang.IllegalArgumentException
- if the specified date is greater (via an compareTo
comparison) than the currently set end date (equal to the
end date is ok)public void setEnd(java.util.Date d)
d
- the end datejava.lang.NullPointerException
- if the specified date was nulljava.lang.IllegalArgumentException
- if the specified end date is lesser (via an compareTo
comparison) than the currently set start date (equal to
the start date is ok)public java.lang.String toString()
toString
in class java.lang.Object
public static void main(java.lang.String[] args)