|
Side of Software Dated Collections Library 2.0 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object sos.dated.util.AbstractDatedObject<D> sos.dated.util.AbstractDatedCollection<E,D> sos.dated.util.AbstractDatedSet<E,D> sos.dated.util.LinkedHashSetByDate<E,D>
E
- the type of elements maintained by this dated setD
- the type of dates used by this dated setpublic class LinkedHashSetByDate<E,D>
An implementation of DatedSet
that uses a
LinkedHashMapByDate
as its underlying data structure.
This implementation is serializable and cloneable; however, it is not
synchronized. To use it safely in a multi-threaded situation, wrap an
instance of the dated set with a call to DatedCollections.synchronizedDatedSet
.
LinkedHashMapByDate
,
DatedSet
,
DatedCollections.synchronizedDatedSet(DatedSet)
Constructor Summary | |
---|---|
LinkedHashSetByDate()
Creates an insertion-ordered LinkedHashSetByDate
with a default initial capacity (16) and a default
load factor (0.75). |
|
LinkedHashSetByDate(DatedCollection<? extends E,D> datedCollection)
Creates an insertion-ordered LinkedHashSetByDate initialized with the elements
and dates of the specified dated collection. |
|
LinkedHashSetByDate(int initialCapacity)
Creates an insertion-ordered LinkedHashSetByDate
with the specified initial capacity and a default
load factor (0.75). |
|
LinkedHashSetByDate(int initialCapacity,
float loadFactor)
Creates an insertion-ordered LinkedHashSetByDate
with the specified initial capacity and a default
load factor (0.75). |
Method Summary | |
---|---|
Dates<D> |
add(E value,
D from,
D to)
Adds the specified element to this dated collection for the specified date range. |
void |
clear(D from,
D to)
Removes all elements from this dated collection for the specified dates. |
java.lang.Object |
clone()
Creates and returns a shallow copy of this object. |
boolean |
contains(java.lang.Object value,
D date)
Returns true if this dated collection contains the specified
element on the specified date. |
boolean |
containsThroughout(java.lang.Object value,
D from,
D to)
Returns true if this dated collection contains the specified
element throughout the specified date range. |
DateIterator<D> |
dateIterator(D at)
Returns an iterator of the date ranges of when this dated object has changed, starting at the range that contains the specified date. |
boolean |
excludesThroughout(java.lang.Object value,
D from,
D to)
Returns true if this dated collection does not contain the
specified element at any date within the specified date range. |
boolean |
hasSizeThroughout(int size,
D from,
D to)
Returns true if the number of elements in this dated collection is
greater than or equal to the specified size throughout the specified
date range. |
boolean |
isEmpty(D at)
Returns true if this dated collection contains no elements on the
specified date. |
boolean |
isEmptyThroughout(D from,
D to)
Returns true if this dated collection contains no elements
throughout the specified date range. |
Iterator<E,D> |
iterator(D at)
Returns an iterator over the elements of this dated collection at the specified date. |
Dates<D> |
remove(java.lang.Object value,
D from,
D to)
Removes an instance of the specified element from this dated collection for the specified date range. |
int |
size(D at)
Returns the number of elements in this dated collection at the specified date. |
Methods inherited from class sos.dated.util.AbstractDatedSet |
---|
equals, hashCode |
Methods inherited from class sos.dated.util.AbstractDatedCollection |
---|
addAll, containsAll, removeAll, retainAll, toArray, toArray, toString |
Methods inherited from class sos.dated.util.AbstractDatedObject |
---|
dateIterator, equals, hashCode, toString |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface sos.dated.util.DatedSet |
---|
equals, hashCode |
Methods inherited from interface sos.dated.util.DatedCollection |
---|
add, addAll, clear, contains, containsAll, containsThroughout, excludesThroughout, hasSizeThroughout, isEmpty, isEmptyThroughout, iterator, remove, removeAll, retainAll, size, toArray, toArray |
Methods inherited from interface sos.dated.util.DatedObject |
---|
dateIterator, dateIterator, equals, hashCode, toString |
Constructor Detail |
---|
public LinkedHashSetByDate()
LinkedHashSetByDate
with a default initial capacity (16) and a default
load factor (0.75).
public LinkedHashSetByDate(int initialCapacity)
LinkedHashSetByDate
with the specified initial capacity and a default
load factor (0.75).
initialCapacity
- the initial capacity at all dates
java.lang.IllegalArgumentException
- if initialCapacity < 0
public LinkedHashSetByDate(int initialCapacity, float loadFactor)
LinkedHashSetByDate
with the specified initial capacity and a default
load factor (0.75).
initialCapacity
- the initial capacity at all datesloadFactor
- the load factor at all dates
java.lang.IllegalArgumentException
- if initialCapacity < 0
or
if loadFactor <= 0.0
public LinkedHashSetByDate(DatedCollection<? extends E,D> datedCollection)
LinkedHashSetByDate
initialized with the elements
and dates of the specified dated collection.
datedCollection
- collection with which to initialize the new LinkedHashSetByDate
java.lang.NullPointerException
- if datedCollection
is null
Method Detail |
---|
public java.lang.Object clone()
clone
in class java.lang.Object
public Dates<D> add(E value, D from, D to)
add
in interface DatedCollection<E,D>
add
in class AbstractDatedCollection<E,D>
value
- element to addfrom
- starting date (inclusive) at which the element should be addedto
- ending date (exclusive) at which the element should be added
java.lang.IllegalArgumentException
- if from
does not precede to
java.lang.NullPointerException
- if from
or to
is null
public void clear(D from, D to)
clear
in interface DatedCollection<E,D>
clear
in class AbstractDatedCollection<E,D>
from
- starting date (inclusive) at which this dated collection should be clearedto
- ending date (exclusive) at which this dated collection should be cleared
java.lang.IllegalArgumentException
- if from
does not precede to
java.lang.NullPointerException
- if if from
or to
is null
public boolean contains(java.lang.Object value, D date)
true
if this dated collection contains the specified
element on the specified date.
contains
in interface DatedCollection<E,D>
contains
in class AbstractDatedCollection<E,D>
value
- element whose presence is to be testeddate
- date at which this collection is to be queried
true
if this dated collection contains the specified element
on the specified date
java.lang.NullPointerException
- if at
is null
DatedCollection.containsThroughout(java.lang.Object, D, D)
public boolean containsThroughout(java.lang.Object value, D from, D to)
true
if this dated collection contains the specified
element throughout the specified date range.
containsThroughout
in interface DatedCollection<E,D>
containsThroughout
in class AbstractDatedCollection<E,D>
value
- element whose presence is to be testedfrom
- starting date (inclusive) at which containment should be testedto
- ending date (exclusive) at which containment should be tested
true
if this dated collection contains the specified element
throughout the specified date range
java.lang.IllegalArgumentException
- if from
does not precede to
java.lang.NullPointerException
- if from
or to
is null
DatedCollection.contains(java.lang.Object, D)
,
DatedCollection.excludesThroughout(java.lang.Object, D, D)
public DateIterator<D> dateIterator(D at)
DatedObject
nextFrom
returns the
same date as previousTo
.
Passing null
as the argument will return an iterator positioned
at the beginning of the sequence.
dateIterator
in interface DatedObject<D>
dateIterator
in class AbstractDatedCollection<E,D>
at
- date to position the iteration
public boolean excludesThroughout(java.lang.Object value, D from, D to)
true
if this dated collection does not contain the
specified element at any date within the specified date range.
excludesThroughout
in interface DatedCollection<E,D>
excludesThroughout
in class AbstractDatedCollection<E,D>
value
- element whose presence is to be testedfrom
- starting date (inclusive) at which exclusion should be testedto
- ending date (exclusive) at which exclusion should be tested
true
if this dated collection does not contain value
at any date between from
and to
java.lang.IllegalArgumentException
- if from
does not precede to
java.lang.NullPointerException
- if from
or to
is null
DatedCollection.containsThroughout(java.lang.Object, D, D)
public boolean hasSizeThroughout(int size, D from, D to)
true
if the number of elements in this dated collection is
greater than or equal to the specified size throughout the specified
date range.
hasSizeThroughout
in interface DatedCollection<E,D>
hasSizeThroughout
in class AbstractDatedCollection<E,D>
size
- number of elements in questionfrom
- starting date (inclusive) at which the size is to be comparedto
- ending date (exclusive) at which the size is to be compared
true
if this dated collection has at least the specified size
throughout the specified date range.
java.lang.IllegalArgumentException
- if size < 0
or if from
does not precede to
java.lang.NullPointerException
- if from
or to
is null
DatedCollection.size(D)
,
DatedCollection.isEmptyThroughout(D, D)
public boolean isEmpty(D at)
true
if this dated collection contains no elements on the
specified date.
isEmpty
in interface DatedCollection<E,D>
isEmpty
in class AbstractDatedCollection<E,D>
at
- date at which this dated collection is to be queried
true
if this dated collection contains no elements on the
specified date
java.lang.NullPointerException
- if at
is null
public boolean isEmptyThroughout(D from, D to)
true
if this dated collection contains no elements
throughout the specified date range.
isEmptyThroughout
in interface DatedCollection<E,D>
isEmptyThroughout
in class AbstractDatedCollection<E,D>
from
- starting date (inclusive) at which this dated collection is to be queriedto
- ending date (exclusive) at which this dated collection is to be queried
true
if this dated collection contains no elements throughout the
specified date range.
java.lang.IllegalArgumentException
- if from
does not precede to
java.lang.NullPointerException
- if from
or to
is null
DatedCollection.isEmpty(D)
public Iterator<E,D> iterator(D at)
UnsupportedOperationException
in its remove
method because a date range is required to remove an element from
this dated collection.
iterator
in interface DatedCollection<E,D>
iterator
in class AbstractDatedCollection<E,D>
at
- date at which to iterate through the elements
java.lang.NullPointerException
- if at
is null
public Dates<D> remove(java.lang.Object value, D from, D to)
remove
in interface DatedCollection<E,D>
remove
in class AbstractDatedCollection<E,D>
value
- element to removefrom
- starting date (inclusive) at which the element should be removedto
- ending date (exclusive) at which the element should be removed
java.lang.IllegalArgumentException
- if from
does not precede to
java.lang.NullPointerException
- if from
or to
is null
DatedCollection.add(E, D, D)
public int size(D at)
size
in interface DatedCollection<E,D>
size
in class AbstractDatedCollection<E,D>
at
- date at which this dated collection is to be queried
java.lang.NullPointerException
- if at
is null
DatedCollection.hasSizeThroughout(int, D, D)
|
Side of Software Dated Collections Library 2.0 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |