|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
An ordered list of non-overlapping date ranges. Each date range is a pair of
java.util.Date objects representing
an interval with a closed start and open end,
[d1,d2). Date d2 must be greater than date d1.
Programmers may use implementations
of this interface to perform date range arithmetic, such as unioning and
differencing.
To union date ranges, use addRange to add a single date range
and addAll to add any number of date ranges. The following diagram
shows the result of adding a Dates object with four
ranges to a Dates object with three ranges through a
call to addAll.
[ ) [ ) [ )
+ [ ) [ ) [ ) [ )
---------------------------------------------
[ ) [ ) [ ) [ )
To find the difference between date ranges, use removeRange,
removeAll, or retainAll. The following digram
shows the result of removing a Dates
object with two ranges from a Dates object with three ranges through
a call to removeAll.
[ ) [ ) [ )
- [ ) [ ]
----------------------------------------------------
[ ) [ ) [ ) [ )
TreeDates| Method Summary | |
Dates |
addAll(Dates dates)
Adds all date ranges given by dates to this series of dates. |
Dates |
addRange(java.util.Date from,
java.util.Date to)
Adds a date range to this series of dates. |
void |
clear()
Removes all date ranges from this series of dates. |
void |
complement()
Modifies this Dates object so that it contains only the ranges not currently
in this Dates object. |
DateIterator |
dateIterator()
Returns a date iterator positioned at the first range in the series. |
DateIterator |
dateIterator(java.util.Date date)
Returns an iterator over the date ranges, beginning with from,
inclusive, and ending with to, exclusive. |
boolean |
equals(java.lang.Object obj)
Indicates if this series of dates is equivalent to the specified object. |
boolean |
excludesAll(Dates dates)
Indicates if this series does not overlap another series of dates. |
boolean |
excludesRange(java.util.Date from,
java.util.Date to)
Indicates if no date range in this series overlaps the specified date range. |
int |
hashCode()
Returns the hash code value of this series of dates. |
boolean |
includes(java.util.Date date)
Indicates if a date range in this series contains the specified date. |
boolean |
includesAll(Dates dates)
Indicates if this series of dates contains all the date ranges given by dates. |
boolean |
includesRange(java.util.Date from,
java.util.Date to)
Indicates if a date range in this series contains the specified date range. |
boolean |
isEmpty()
Indicates if this series of dates is empty. |
Dates |
removeAll(Dates dates)
Removes all dates ranges given by dates from this series of dates. |
Dates |
removeRange(java.util.Date from,
java.util.Date to)
Removes the specified range from this series of dates. |
Dates |
retainAll(Dates dates)
Removes all but the date ranges given by dates from this
series of dates. |
int |
size()
Returns the number of date ranges included in this series. |
java.util.Date[] |
toDateArray()
Converts this series of dates to an array of dates, where a date at an even index represents the start (inclusive) of a range and a date at an odd index represents the end (exclusive) of a range. |
java.util.Date[] |
toDateArray(java.util.Date[] a)
Converts this series of dates to an array of dates, where a date at an even index represents the start (inclusive) of a range and a date at an odd index represents the end (exclusive) of a range. |
| Method Detail |
public Dates addAll(Dates dates)
dates to this series of dates.
The returned value indicates when this series of date ranges changed as
a result of the call and is applicable only for the specified date range.
It may be read-only, and it is not tied to this Dates object.
dates - series of dates to be added
java.lang.NullPointerException - if dates is null
public Dates addRange(java.util.Date from,
java.util.Date to)
The returned value indicates when this series of date ranges changed as
a result of the call and is applicable only for the specified date range.
It may be read-only, and it is not tied to this Dates object.
from - start of the date range, inclusiveto - end of the date range, exclusive
public void clear()
public void complement()
Dates object so that it contains only the ranges not currently
in this Dates object.
public DateIterator dateIterator()
dateIterator(DatedObject.MIN_DATE).
public DateIterator dateIterator(java.util.Date date)
from,
inclusive, and ending with to, exclusive.
public boolean equals(java.lang.Object obj)
equals in class java.lang.Objectobj - object to be compared to this series of dates
true if this series equals objpublic boolean excludesAll(Dates dates)
dates - date ranges to test for exclusion
true if no date range of this series overlaps
a date range of the specified series
java.lang.NullPointerException - if dates is null
public boolean excludesRange(java.util.Date from,
java.util.Date to)
from - start of date range (inclusive) to test for exclusionto - end of date range (exclusive) to test for exclusion
true if no date range of this series overlaps
the specified date rangepublic int hashCode()
Dates
object is defined to be
hashCode += 31 * ( from.hashCode() + to.hashCode() );for each range [from,to) in this object.
hashCode in class java.lang.Objectpublic boolean includes(java.util.Date date)
date - date to test for inclusion
true if this series of dates contains the specified date
java.lang.NullPointerException - if date is nullpublic boolean includesAll(Dates dates)
dates.
dates - date ranges to test for inclusion
true if this series of dates contains all of
the specified date ranges
java.lang.NullPointerException - if dates is null
public boolean includesRange(java.util.Date from,
java.util.Date to)
from - start of date range (inclusive) to test for inclusionto - end of date range (exclusive) to test for inclusion
true if this series of dates contains the specified date
rangepublic boolean isEmpty()
true if no date ranges exist in this seriespublic Dates removeAll(Dates dates)
dates from this series of dates.
The returned value indicates when this series of date ranges changed as
a result of the call and is applicable only for the specified date range.
It may be read-only, and it is not tied to this Dates object.
dates - date ranges to be removed
public Dates removeRange(java.util.Date from,
java.util.Date to)
The returned value indicates when this series of date ranges changed as
a result of the call and is applicable only for the specified date range.
It may be read-only, and it is not tied to this Dates object.
from - start of date range to remove (inclusive)to - end of date range to remove (exclusive)
public Dates retainAll(Dates dates)
dates from this
series of dates.
The returned value indicates when this series of date ranges changed as
a result of the call and is applicable only for the specified date range.
It may be read-only, and it is not tied to this Dates object.
dates - date ranges to retain
public int size()
public java.util.Date[] toDateArray()
public java.util.Date[] toDateArray(java.util.Date[] a)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||