|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--sos.dated.util.AbstractDatedObject
|
+--sos.dated.util.AbstractDatedMap
|
+--sos.dated.util.AbstractMapByDate
|
+--sos.dated.util.TreeMapByDate
An implementation of DatedSortedMap that maintains a java.util.TreeMap
at each date where a change occurs, yielding fast date iterations and logarithmic
retrievals.
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 map with a call to DatedCollections.synchronizedDatedMap.
TreeMapByKey,
HashMapByDate,
DatedMap,
DatedCollections.synchronizedDatedMap(DatedMap)| Nested Class Summary |
| Nested classes inherited from class sos.dated.util.DatedMap |
DatedMap.Entry |
| Field Summary |
| Fields inherited from interface sos.dated.util.DatedObject |
MAX_DATE, MIN_DATE |
| Constructor Summary | |
TreeMapByDate()
Constructs a new instance of TreeMapByDate that uses the natural ordering
of keys. |
|
TreeMapByDate(java.util.Comparator comparator)
Constructs a new instance of TreeMapByDate that uses the specified comparator
to order the keys. |
|
TreeMapByDate(DatedMap datedMap)
Constructs a new instance of TreeMapByDate that uses the natural ordering
of keys and initially contains the mappings of datedMap. |
|
TreeMapByDate(DatedSortedMap datedSortedMap)
Constructs a new TreeMapByDate that initially contains the mappings
of datedSortedMap. |
|
| Method Summary | |
java.lang.Object |
clone()
Creates and returns a copy of this object. |
java.util.Comparator |
comparator()
Returns the comparator used to sorted the keys of this dated map. |
protected java.util.Map |
copyMap(java.util.Map map)
Returns a new TreeMap initialized with the mappings of
map. |
protected java.util.Map |
createMap()
Returns a freshly created, empty TreeMap. |
java.lang.Object |
firstKey(java.util.Date date)
Returns the smallest key in this dated map at the specified date. |
DatedSortedMap |
headMap(java.lang.Object toKey)
Returns a view of this dated map of all mappings whose keys precede toKey. |
java.lang.Object |
lastKey(java.util.Date date)
Returns the largest key in this dated map at the specified date. |
DatedSortedMap |
subMap(java.lang.Object fromKey,
java.lang.Object toKey)
Returns a view of this dated map of all mappings whose keys fall between fromKey (inclusive) and toKey (exclusive). |
DatedSortedMap |
tailMap(java.lang.Object fromKey)
Returns a view of this dated map of all mappings whose keys are greater than or equal to toKey. |
| Methods inherited from class sos.dated.util.AbstractMapByDate |
checkForComodification, containsKey, containsValue, dateIterator, entrySet, modCount, put, remove, upModCount |
| Methods inherited from class sos.dated.util.AbstractDatedMap |
clear, containsKeyThroughout, containsValueThroughout, equals, excludesKeyThroughout, excludesValueThroughout, get, get, hashCode, hasSizeThroughout, isEmpty, isEmptyThroughout, keySet, putAll, size, toString, values |
| 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.DatedMap |
clear, containsKey, containsKeyThroughout, containsValue, containsValueThroughout, entrySet, equals, excludesKeyThroughout, excludesValueThroughout, get, get, hashCode, hasSizeThroughout, isEmpty, isEmptyThroughout, keySet, put, putAll, remove, size, values |
| Methods inherited from interface sos.dated.util.DatedObject |
dateIterator, dateIterator, equals, hashCode, toString |
| Constructor Detail |
public TreeMapByDate()
TreeMapByDate that uses the natural ordering
of keys. All keys placed in this map must implement the Comparable interface.
public TreeMapByDate(DatedMap datedMap)
TreeMapByDate that uses the natural ordering
of keys and initially contains the mappings of datedMap.
All keys laced in this map must implement the Comparable interface.
datedMap - dated map with which to initialize this TreeMapByDate
java.lang.NullPointerException - if datedMap is null.public TreeMapByDate(java.util.Comparator comparator)
TreeMapByDate that uses the specified comparator
to order the keys. The comparator should not throw an exception for
any key placed in this map. A comparator with the value null causes this
map to rely on the natural ordering of the keys.
comparator - object used to order the keys (may be null)public TreeMapByDate(DatedSortedMap datedSortedMap)
TreeMapByDate that initially contains the mappings
of datedSortedMap. This map uses the specified dated map's
comparator to order the keys.
datedSortedMap - dated sorted map with which to initialize
this TreeMapByDate
java.lang.NullPointerException - if datedSortedMap is null.| Method Detail |
public java.lang.Object clone()
AbstractDatedMapclone method.
clone in class AbstractMapByDatepublic java.util.Comparator comparator()
DatedSortedMap
comparator in interface DatedSortedMapprotected java.util.Map createMap()
TreeMap.
createMap in class AbstractMapByDateTreeMap.protected java.util.Map copyMap(java.util.Map map)
TreeMap initialized with the mappings of
map.
copyMap in class AbstractMapByDatemap - mappings to be included in the new map
TreeMap initialized with the mappings of
map.public java.lang.Object firstKey(java.util.Date date)
DatedSortedMap
firstKey in interface DatedSortedMapdate - date for which to find the smallest key
datepublic DatedSortedMap headMap(java.lang.Object toKey)
DatedSortedMap
headMap in interface DatedSortedMaptoKey - upper bound of the keys of the returned map (exclusive)
public java.lang.Object lastKey(java.util.Date date)
DatedSortedMap
lastKey in interface DatedSortedMapdate - date for which to find the largest key
date
public DatedSortedMap subMap(java.lang.Object fromKey,
java.lang.Object toKey)
DatedSortedMap
subMap in interface DatedSortedMapfromKey - lower bound of the keys of the returned map (inclusive)toKey - upper bound of the keys of the returned map (exclusive)
public DatedSortedMap tailMap(java.lang.Object fromKey)
DatedSortedMap
tailMap in interface DatedSortedMapfromKey - lower bound of the keys of the returned map (inclusive)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||