public class DateRange
extends java.lang.Object
implements java.io.Serializable
Modifier and Type | Field and Description |
---|---|
static int |
INCLUSIVE_END
A flag indicating whether to include the end of the period in test functions.
|
static int |
INCLUSIVE_START
A flag indicating whether to include the start of the period in test functions.
|
Constructor and Description |
---|
DateRange(java.util.Date start,
java.util.Date end) |
Modifier and Type | Method and Description |
---|---|
boolean |
adjacent(DateRange range)
Decides whether these periods are serial without a gap.
|
boolean |
after(DateRange range)
Decides whether this period starts after the given period ends.
|
boolean |
before(DateRange range)
Decides whether this period is completed before the given period starts.
|
boolean |
contains(DateRange range)
Decides whether the given period is completely contained within this one.
|
java.util.Date |
getRangeEnd() |
java.util.Date |
getRangeStart() |
boolean |
includes(java.util.Date date)
Determines if the specified date occurs within this period (inclusive of
period start and end).
|
boolean |
includes(java.util.Date date,
int inclusiveMask)
Decides whether a date falls within this period.
|
boolean |
intersects(DateRange range)
Decides whether this period intersects with another one.
|
public static final int INCLUSIVE_START
public static final int INCLUSIVE_END
public DateRange(java.util.Date start, java.util.Date end)
start
- the start of the rangeend
- the end of the rangepublic java.util.Date getRangeStart()
public java.util.Date getRangeEnd()
public final boolean includes(java.util.Date date)
date
- a date to test for inclusionpublic final boolean includes(java.util.Date date, int inclusiveMask)
date
- the date to be testedinclusiveMask
- specifies whether period start and end are included
in the calculationINCLUSIVE_START
,
INCLUSIVE_END
public final boolean before(DateRange range)
range
- a period that may or may not start after this period endspublic final boolean after(DateRange range)
range
- a period that may or may not end before this period startspublic final boolean intersects(DateRange range)
range
- a possible intersecting periodpublic final boolean adjacent(DateRange range)
range
- a period to test for adjacencypublic final boolean contains(DateRange range)
range
- the period that may be contained by this one