|
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.AbstractDatedValue<E,D>
sos.dated.util.ValueByDate<E,D>
E - the type of value maintained by this dated valueD - the type of dates used by this dated valuepublic class ValueByDate<E,D>
An implementation of DatedValue that can efficiently produce the value
at a given date. The following illustration shows a conceptual view of
a small ValueByDate where the "dates" are integers and the values are
characters:

[1,2): K [2,3): M [3,5): A [5,6): B [7,9): MThis 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 object with a call to
DatedCollections.synchronizedDatedValue.
DatedValue,
DatedCollections.synchronizedDatedValue(sos.dated.util.DatedValue) | Constructor Summary | |
|---|---|
ValueByDate()
Creates a ValueByDate with a null value over all dates. |
|
ValueByDate(DatedValue<? extends E,D> datedValue)
Creates a ValueByDate with the same values as the specified dated
value. |
|
| Method Summary | |
|---|---|
java.lang.Object |
clone()
Creates and returns a shallow copy of this object. |
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. |
E |
get(D at)
Returns the value at a specified date. |
DatedValue<E,D> |
set(E value,
D from,
D to)
Sets the value for a specified date range. |
| Methods inherited from class sos.dated.util.AbstractDatedValue |
|---|
equals, hashCode, is, isNotThroughout, isThroughout, 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.DatedValue |
|---|
equals, hashCode, is, isNotThroughout, isThroughout |
| Methods inherited from interface sos.dated.util.DatedObject |
|---|
dateIterator, equals, hashCode, toString |
| Constructor Detail |
|---|
public ValueByDate()
ValueByDate with a null value over all dates.
public ValueByDate(DatedValue<? extends E,D> datedValue)
ValueByDate with the same values as the specified dated
value.
datedValue - values used to initialize this object
java.lang.NullPointerException - if datedValue is null| Method Detail |
|---|
public java.lang.Object clone()
clone in class java.lang.Objectpublic 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 AbstractDatedObject<D>at - date to position the iteration
public E get(D at)
null
if no value has been set for that date. Thus, it is impossible to
distinguish an unset value and a set value of null. If
such a distinction is necessary, the client can use a special marker
value instead of null to signal a null value.
get in interface DatedValue<E,D>at - date at which this dated value is to be queried
java.lang.NullPointerException - if at is null
public DatedValue<E,D> set(E value,
D from,
D to)
set in interface DatedValue<E,D>set in class AbstractDatedValue<E,D>value - value to be setfrom - starting date (inclusive) at which the value should holdto - ending date (exclusive) at which the value should hold
DatedValue indicating the
values held in the date range of interest before
the call to set.
java.lang.IllegalArgumentException - to is not greater than from
java.lang.NullPointerException - if from or to is null
|
Side of Software Dated Collections Library 2.0 |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||