|
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.Objectsos.dated.util.AbstractDatedObject<D>
sos.dated.util.AbstractDatedCollection<E,D>
sos.dated.util.AbstractDatedSet<E,D>
sos.dated.util.HashSetByElement<E,D>
E - the type of elements maintained by this dated setD - the type of dates used by this dated setpublic class HashSetByElement<E,D>
An implementation of DatedSet that uses a HashMapByKey as its underlying
data structure. The following illustration shows a conceptual view of
a small HashSetByElement where the "dates" are integers and the elements are
characters:

[1,2): {K,B,M}
[3,5): {K,A,B,M}
[5,6): {M}
[6,9): {K,A,B}
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.
HashSetByDate,
TreeSetByElement,
DatedSet,
HashMapByKey,
DatedCollections.synchronizedDatedSet(DatedSet)| Constructor Summary | |
|---|---|
HashSetByElement()
Creates a new instance of HashSetByElement. |
|
HashSetByElement(DatedCollection<? extends E,D> datedCollection)
Creates a new instance of HashSetByElement initialized with the elements
and dates of the specified dated collection. |
|
HashSetByElement(int initialCapacity)
Creates a new instance of HashSetByElement with the specified initial capacity
and default load factor (0.75). |
|
HashSetByElement(int initialCapacity,
float loadFactor)
Creates a new instance of HashSetByElement with the
specified initial capacity and load factor. |
|
| 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 HashSetByElement()
HashSetByElement.
public HashSetByElement(int initialCapacity)
HashSetByElement with the specified initial capacity
and default load factor (0.75).
The initial capacity is used to initialize the underlying HashMapByKey,
which holds all elements across all time.
initialCapacity - initial capacity of the underlying hash map
java.lang.IllegalArgumentException - if initialCapacity < 0
public HashSetByElement(int initialCapacity,
float loadFactor)
HashSetByElement with the
specified initial capacity and load factor.
initialCapacity - load capacity of the underlying hash maploadFactor - load factor of the underlying hash map
java.lang.IllegalArgumentException - if initialCapacity < 0 or
if loadFactor <= 0.0public HashSetByElement(DatedCollection<? extends E,D> datedCollection)
HashSetByElement initialized with the elements
and dates of the specified dated collection.
datedCollection - collection with which to initialize the new
HashSetByElement| 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 nullDatedCollection.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 nullDatedCollection.contains(java.lang.Object, D),
DatedCollection.excludesThroughout(java.lang.Object, D, D)public DateIterator<D> dateIterator(D at)
DatedObjectnextFrom 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 nullDatedCollection.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 nullDatedCollection.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 nullDatedCollection.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 nullDatedCollection.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 nullDatedCollection.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 | ||||||||