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