|
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.Adapters
public class Adapters
A bridge between dated and non-dated collections.
This class provides two ways to disguise a dated collection as a non-dated
collection. The first returns a snapshot at the collection at a given date.
Since the returned non-dated collections reflect an instant in time, they are
unmodifiable. For this approach, use the following methods. Note that there
is no need for a DatedValue
view because all dated values
provide a get
method.
asCollection(DatedCollection,D)
asList(DatedList,D)
asSet(DatedSet,D)
asSortedSet(DatedSortedSet,D)
asSortedMap(DatedSortedMap,D)
asMap(DatedMap,D)
asCollection(DatedCollection,D,D)
asList(DatedList,D,D)
asSet(DatedSet,D,D)
asSortedSet(DatedSortedSet,D,D)
asSortedMap(DatedSortedMap,D,D)
asMap(DatedMap,D,D)
asDatedCollection(Collection,D,D)
asDatedList(List,D,D)
asDatedSet(Set,D,D)
asDatedSortedSet(SortedSet,D,D)
asDatedSortedMap(SortedMap,D,D)
asDatedMap(Map,D,D)
DatedCollection
,
DatedSet
,
DatedList
,
DatedMap
,
DatedCollections
Method Summary | ||
---|---|---|
static
|
asCollection(DatedCollection<E,D> datedCollection,
D at)
Returns an unmodifiable non-dated version of the specified dated collection at the specified date. |
|
static
|
asCollection(DatedCollection<E,D> datedCollection,
D from,
D to)
Returns a modifiable non-dated version of the specified dated collection for the specified date range. |
|
static
|
asDatedCollection(java.util.Collection<E> collection,
D from,
D to)
Treats a non-dated collection as a dated collection between the specified dates. |
|
static
|
asDatedList(java.util.List<E> list,
D from,
D to)
Returns an unmodifiable dated view of a list. |
|
static
|
asDatedMap(java.util.Map<K,V> map,
D from,
D to)
Treats a non-dated map as a dated map between the specified dates. |
|
static
|
asDatedSet(java.util.Set<E> set,
D from,
D to)
Treats a non-dated set as a dated set between the specified dates. |
|
static
|
asDatedSortedMap(java.util.SortedMap<K,V> map,
D from,
D to)
Treats a non-dated sorted map as a dated sorted map between the specified dates. |
|
static
|
asDatedSortedSet(java.util.SortedSet<E> set,
D from,
D to)
Treats a non-dated sorted set as a dated sorted set between the specified dates. |
|
static
|
asDatedValue(E value,
D from,
D to)
Treats a non-dated value as a dated value between the specified dates. |
|
static
|
asList(DatedList<E,D> datedList,
D at)
Returns an unmodifiable non-dated version of the specified dated list at the specified date. |
|
static
|
asList(DatedList<E,D> datedList,
D from,
D to)
Returns a modifiable non-dated version of the specified dated list for the specified date range. |
|
static
|
asMap(DatedMap<K,V,D> datedMap,
D at)
Returns an unmodifiable non-dated version of the specified dated map at the specified date. |
|
static
|
asMap(DatedMap<K,V,D> datedMap,
D from,
D to)
Returns a modifiable non-dated version of the specified dated map for the specified date range. |
|
static
|
asSet(DatedSet<E,D> datedSet,
D at)
Returns an unmodifiable non-dated version of the specified dated set at the specified date. |
|
static
|
asSet(DatedSet<E,D> datedSet,
D from,
D to)
Returns a modifiable non-dated version of the specified dated set for the specified date range. |
|
static
|
asSortedMap(DatedSortedMap<K,V,D> datedSortedMap,
D at)
Returns an unmodifiable non-dated version of the specified dated sorted map at the specified date. |
|
static
|
asSortedMap(DatedSortedMap<K,V,D> datedSortedMap,
D from,
D to)
Returns a modifiable non-dated version of the specified dated sorted map for the specified date range. |
|
static
|
asSortedSet(DatedSortedSet<E,D> datedSet,
D at)
Returns an unmodifiable non-dated version of the specified dated sorted set at the specified date. |
|
static
|
asSortedSet(DatedSortedSet<E,D> datedSortedSet,
D from,
D to)
Returns a modifiable non-dated version of the specified dated sorted set for the specified date range. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static <E,D> java.util.Collection<E> asCollection(DatedCollection<E,D> datedCollection, D at)
UnsupportedOperationException
.
The returned collection "wraps" the dated collection. Therefore, it is
essential that the client does not modify the dated collection
while using the returned collection.
The returned collection is serializable only if the dated collection
is serializable.
datedCollection
- dated collection to treat as non-datedat
- date slice of datedCollection to treat as a Collection
java.lang.NullPointerException
- if any argument is null
public static <E,D> java.util.List<E> asList(DatedList<E,D> datedList, D at)
UnsupportedOperationException
.
The returned collection "wraps" the dated list. Therefore, it is
essential that the client does not modify the dated list
while using the returned list.
The returned list is serializable only if the dated collection
is serializable. Also, the returned list implements java.util.RandomAccess
only
if the dated list implements java.util.RandomAccess
.
datedList
- dated list to treat as non-datedat
- date slice of datedList to treat as a List
java.lang.NullPointerException
- if any argument is null
public static <E,D> java.util.Set<E> asSet(DatedSet<E,D> datedSet, D at)
UnsupportedOperationException
.
The returned set "wraps" the dated set. Therefore, it is
essential that the client does not modify the dated set
while using the returned set.
The returned set is serializable only if the dated set
is serializable.
datedSet
- dated set to treat as non-datedat
- date slice of datedSet to treat as a Set
java.lang.NullPointerException
- if any argument is null
public static <K,V,D> java.util.SortedMap<K,V> asSortedMap(DatedSortedMap<K,V,D> datedSortedMap, D at)
UnsupportedOperationException
.
The returned sorted map "wraps" the dated sorted map. Therefore, it is
essential that the client does not modify the dated map
while using the returned map.
The returned map is serializable only if the dated map
is serializable.
datedSortedMap
- dated sorted map to treat as non-datedat
- date slice of datedSortedMap to treat as a SortedMap
java.lang.NullPointerException
- if any argument is null
public static <E,D> java.util.SortedSet<E> asSortedSet(DatedSortedSet<E,D> datedSet, D at)
UnsupportedOperationException
.
The returned set "wraps" the dated set. Therefore, it is
essential that the client does not modify the dated set
while using the returned set.
The returned set is serializable only if the dated set
is serializable.
datedSet
- dated sorted set to treat as non-datedat
- date slice of datedSortedSet to treat as a SortedSet
java.lang.NullPointerException
- if any argument is null
public static <K,V,D> java.util.Map<K,V> asMap(DatedMap<K,V,D> datedMap, D at)
UnsupportedOperationException
.
The returned map "wraps" the dated map. Therefore, it is
essential that the client does not modify the dated map
while using the returned map.
The returned map is serializable only if the dated map
is serializable.
datedMap
- dated map to treat as non-datedat
- date slice of datedMap to treat as a Map
java.lang.NullPointerException
- if any argument is null
public static <E,D> java.util.Collection<E> asCollection(DatedCollection<E,D> datedCollection, D from, D to)
datedCollection
- dated collection to treat as non-datedfrom
- start date (inclusive) of static range of datedCollection
to treat as non-datedto
- end date (exclusive) of static range of datedCollection
to treat as non-dated
DateOutOfRangeException
- if datedCollection changes between from and to
java.lang.IllegalArgumentException
- if from
does not precede to
java.lang.NullPointerException
- if any argument is null
public static <E,D> java.util.List<E> asList(DatedList<E,D> datedList, D from, D to)
java.util.RandomAccess
only
if the dated list implements java.util.RandomAccess
.
datedList
- dated list to treat as non-datedfrom
- start date (inclusive) of static range of datedList
to treat as non-datedto
- end date (exclusive) of static range of datedList
to treat as non-dated
DateOutOfRangeException
- if datedList changes between from and to
java.lang.IllegalArgumentException
- if from
does not precede to
java.lang.NullPointerException
- if any argument is null
public static <K,V,D> java.util.Map<K,V> asMap(DatedMap<K,V,D> datedMap, D from, D to)
datedMap
- dated map to treat as non-datedfrom
- start date (inclusive) of static range of datedMap
to treat as non-datedto
- end date (exclusive) of static range of datedMap
to treat as non-dated
DateOutOfRangeException
- if datedMap changes between from and to
java.lang.IllegalArgumentException
- if from
does not precede to
java.lang.NullPointerException
- if any argument is null
public static <E,D> java.util.Set<E> asSet(DatedSet<E,D> datedSet, D from, D to)
datedSet
- dated set to treat as non-datedfrom
- start date (inclusive) of static range of datedSet
to treat as non-datedto
- end date (exclusive) of static range of datedSet
to treat as non-dated
DateOutOfRangeException
- if datedSet changes between from and to
java.lang.IllegalArgumentException
- if from
does not precede to
java.lang.NullPointerException
- if any argument is null
public static <K,V,D> java.util.SortedMap<K,V> asSortedMap(DatedSortedMap<K,V,D> datedSortedMap, D from, D to)
datedSortedMap
- dated sorted map to treat as non-datedfrom
- start date (inclusive) of static range of datedSortedMap
to treat as non-datedto
- end date (exclusive) of static range of datedSortedMap
to treat as non-dated
DateOutOfRangeException
- if datedSortedMap changes between from and to
java.lang.IllegalArgumentException
- if from
does not precede to
java.lang.NullPointerException
- if any argument is null
public static <E,D> java.util.SortedSet<E> asSortedSet(DatedSortedSet<E,D> datedSortedSet, D from, D to)
datedSortedSet
- dated sorted set to treat as non-datedfrom
- start date (inclusive) of static range of datedSortedSet
to treat as non-datedto
- end date (exclusive) of static range of datedSortedSet
to treat as non-dated
DateOutOfRangeException
- if datedSortedSet changes between from and to
java.lang.IllegalArgumentException
- if from
does not precede to
java.lang.NullPointerException
- if any argument is null
public static <E,D> DatedCollection<E,D> asDatedCollection(java.util.Collection<E> collection, D from, D to)
collection
- collection to treat as datedfrom
- start date (inclusive) of range for which the returned dated collection
should contain the elements of collectionto
- end date (exclusive) of range for which the returned dated collection
should contain the elements of collection
java.lang.IllegalArgumentException
- if from
does not precede to
java.lang.NullPointerException
- if any argument is null
public static <E,D> DatedList<E,D> asDatedList(java.util.List<E> list, D from, D to)
list
- list to be viewed as datedfrom
- starting date (inclusive)to
- ending date (exclusive)
java.lang.IllegalArgumentException
- if from
does not precede to
java.lang.NullPointerException
- if any argument is null
public static <K,V,D> DatedMap<K,V,D> asDatedMap(java.util.Map<K,V> map, D from, D to)
map
- map to be treated as datedfrom
- start of date range (inclusive) for which the returned dated
map has the entries of the specified mapto
- end of date range (exclusive) for which the returned dated
map has the entries of the specified map
java.lang.IllegalArgumentException
- if from
does not precede to
java.lang.NullPointerException
- if any argument is null
public static <E,D> DatedSet<E,D> asDatedSet(java.util.Set<E> set, D from, D to)
set
- set to be treated as datedfrom
- start of date range (inclusive) for which the returned dated
set has the elements of the specified setto
- end of date range (exclusive) for which the returned dated
set has the elements of the specified set
java.lang.IllegalArgumentException
- if from
does not precede to
java.lang.NullPointerException
- if any argument is null
public static <K,V,D> DatedSortedMap<K,V,D> asDatedSortedMap(java.util.SortedMap<K,V> map, D from, D to)
map
- sorted map to be treated as datedfrom
- start of date range (inclusive) for which the returned dated
map has the entries of the specified mapto
- end of date range (exclusive) for which the returned dated
map has the entries of the specified map
java.lang.IllegalArgumentException
- if from
does not precede to
java.lang.NullPointerException
- if any argument is null
public static <E,D> DatedSortedSet<E,D> asDatedSortedSet(java.util.SortedSet<E> set, D from, D to)
set
- sorted set to be treated as datedfrom
- start of date range (inclusive) for which the returned dated
set has the elements of the specified setto
- end of date range (exclusive) for which the returned dated
set has the elements of the specified set
java.lang.IllegalArgumentException
- if from
does not precede to
java.lang.NullPointerException
- if any argument is null
public static <E,D> DatedValue<E,D> asDatedValue(E value, D from, D to)
value
- value to be treated as datedfrom
- start of date range (inclusive) for which the returned dated
value has the specified valueto
- end of date range (exclusive) for which the returned dated
value has the specified value
java.lang.IllegalArgumentException
- if from
does not precede to
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 |