|
|||||||||
| Home >> All >> [ jtemporal overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
jtemporal
Class TreeTemporalMultiMap

java.lang.Objectjtemporal.AbstractTemporalMultiMap
jtemporal.TreeTemporalMultiMap
- All Implemented Interfaces:
- TemporalMultiMap
- public class TreeTemporalMultiMap
- extends AbstractTemporalMultiMap
Maintains internally a TreeMap over the periods and an HashMap over the values
so that query performances are acceptable for queries in both dimensions even when
the collection is very large.
Note: this implementation is not synchronized. If multiple
threads access the map concurrently, and at least one of the threads modifies
the map structurally, it must be synchronized externally. (A
structural modification is any operation that adds or deletes one or more
mappings; merely changing the value associated with an existing key is not
a structural modification.) This is typically accomplished by
synchronizing on some object that naturally encapsulates the map. If no
such object exists, the map should be "wrapped" using the
SynchronizedTemporalMultiMap.getInstance method. This is best done at creation
time, to prevent accidental unsynchronized access to the map:
TemporalMultiMap tm = SynchronizedTemporalMap.getInstance(new TreeTemporalMultiMap(...));
Note the synchronizing proxies are not available yet.
(internal structure)
In a future version, this structure will be optimized in order to reduce the
memory usage when the map contains few values.
- Version:
- $Id$
| Nested Class Summary | |
(package private) class |
TreeTemporalMultiMap.SortedMapSubscriber
Listening the inner loop treeMaps, allows to know what is really changed, because for example a "put" invocation can partially overwrite preexisting information. |
private class |
TreeTemporalMultiMap.ValueSetView
|
| Field Summary | |
private NodeParent |
nodeDeadListener
This inner class has been created because it is impossible to implement a non public insterface without declaring the implementing methods as public :-( (http://developer.java.sun.com/developer/bugParade/bugs/4456057.html) |
private java.util.SortedMap |
timeMap
|
private java.util.Map |
valueMap
|
private java.lang.Class |
valueType
|
| Constructor Summary | |
TreeTemporalMultiMap()
Default constructor. |
|
TreeTemporalMultiMap(java.lang.Class valueType)
|
|
| Method Summary | |
void |
clear()
Removes all the mappings from this map (optional operation). |
boolean |
contains(Instant instant,
java.lang.Object value)
Returns true if there is a mapping for this value at the given instant. |
boolean |
containsValue(java.lang.Object value)
Returns true if if ther is a mapping for the specified value. |
Instant |
firstInstant(java.lang.Object value)
Returns the first (lowest) instant currently defined for the given value. |
Period |
firstPeriod(java.lang.Object value)
Returns the first (lowest) period currently defined for the given value. |
Period |
getPeriod(Instant instant,
java.lang.Object value)
Returns the period of the mapping valid at the specified instant for the value. |
private TemporalUnaryMap |
getTemporalUnaryMap(java.lang.Object value)
|
private TemporalUnaryMap |
getTemporalUnaryMapOrNull(java.lang.Object value)
|
boolean |
isEmpty()
Returns true if this map contains no Period-value mappings. |
Instant |
lastInstant(java.lang.Object value)
Returns the last (highest) instant currently defined for the given value. |
Period |
lastPeriod(java.lang.Object value)
Returns the last (highest) period currently defined for the given value. |
java.util.Set |
periodSet(java.lang.Object value)
Returns a set view of the periods contained in this map for the give value. |
boolean |
put(Period p,
java.lang.Object value)
Associates the specified value to the specified Period in this map. |
boolean |
remove(Period p,
java.lang.Object value)
Removes the mapping(s) for this period and value from this map if present (optional operation). |
boolean |
removePeriod(Period p)
Removes all the mapping(s) for this period from this map if present (optional operation). |
void |
removeValue(java.lang.Object value)
Removes all the mapping(s) for this value from this map if present (optional operation). |
int |
size(java.lang.Object value)
Returns the number of Period-value mappings in this map. |
java.util.Set |
valueSet()
Returns a read-only Set containing the values defined somewhen in this map. |
java.util.Set |
valueSet(Instant instant)
Returns a read-only Set containing the values defined in this map at the specified instant. |
| Methods inherited from class jtemporal.AbstractTemporalMultiMap |
equals, extent, putAll |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
valueMap
private final java.util.Map valueMap
timeMap
private final java.util.SortedMap timeMap
valueType
private final java.lang.Class valueType
nodeDeadListener
private final NodeParent nodeDeadListener
- This inner class has been created because it is impossible to implement a non public insterface
without declaring the implementing methods as public :-(
(http://developer.java.sun.com/developer/bugParade/bugs/4456057.html)
| Constructor Detail |
TreeTemporalMultiMap
public TreeTemporalMultiMap()
- Default constructor. Values of any type will be accepted.
TreeTemporalMultiMap
public TreeTemporalMultiMap(java.lang.Class valueType)
| Method Detail |
firstInstant
public Instant firstInstant(java.lang.Object value)
- Description copied from interface:
TemporalMultiMap - Returns the first (lowest) instant currently defined for the given value.
- Specified by:
firstInstantin interfaceTemporalMultiMap- Specified by:
firstInstantin classAbstractTemporalMultiMap
lastInstant
public Instant lastInstant(java.lang.Object value)
- Description copied from interface:
TemporalMultiMap - Returns the last (highest) instant currently defined for the given value.
- Specified by:
lastInstantin interfaceTemporalMultiMap- Specified by:
lastInstantin classAbstractTemporalMultiMap
getPeriod
public Period getPeriod(Instant instant, java.lang.Object value)
- Description copied from interface:
TemporalMultiMap - Returns the period of the mapping valid at the specified instant for the value.
- Specified by:
getPeriodin interfaceTemporalMultiMap- Specified by:
getPeriodin classAbstractTemporalMultiMap
contains
public boolean contains(Instant instant, java.lang.Object value)
- Description copied from interface:
TemporalMultiMap - Returns true if there is a mapping for this value at the given instant.
Same as containsValue(Instant instant, Object value)
- Specified by:
containsin interfaceTemporalMultiMap- Specified by:
containsin classAbstractTemporalMultiMap
containsValue
public boolean containsValue(java.lang.Object value)
- Description copied from interface:
TemporalMultiMap - Returns true if if ther is a mapping for the specified value.
- Specified by:
containsValuein interfaceTemporalMultiMap- Specified by:
containsValuein classAbstractTemporalMultiMap
firstPeriod
public Period firstPeriod(java.lang.Object value)
- Description copied from interface:
TemporalMultiMap - Returns the first (lowest) period currently defined for the given value.
- Specified by:
firstPeriodin interfaceTemporalMultiMap- Specified by:
firstPeriodin classAbstractTemporalMultiMap
lastPeriod
public Period lastPeriod(java.lang.Object value)
- Description copied from interface:
TemporalMultiMap - Returns the last (highest) period currently defined for the given value.
- Specified by:
lastPeriodin interfaceTemporalMultiMap- Specified by:
lastPeriodin classAbstractTemporalMultiMap
isEmpty
public boolean isEmpty()
- Description copied from interface:
TemporalMultiMap - Returns true if this map contains no Period-value mappings.
- Specified by:
isEmptyin interfaceTemporalMultiMap- Specified by:
isEmptyin classAbstractTemporalMultiMap
size
public int size(java.lang.Object value)
- Description copied from interface:
TemporalMultiMap - Returns the number of Period-value mappings in this map. If the
map contains more than Integer.MAX_VALUE elements, returns
Integer.MAX_VALUE.
- Specified by:
sizein interfaceTemporalMultiMap- Specified by:
sizein classAbstractTemporalMultiMap
periodSet
public java.util.Set periodSet(java.lang.Object value)
- Description copied from interface:
TemporalMultiMap - Returns a set view of the periods contained in this map for the give value.
The set is
backed by the map, so changes to the map are reflected in the set, and
vice-versa. If the map is modified while an iteration over the set is
in progress, the results of the iteration are undefined. The set
supports element removal, which removes the corresponding mapping from
the map, via the Iterator.remove, Set.remove,
removeAll retainAll, and clear operations.
It does not support the add or addAll operations.
- Specified by:
periodSetin interfaceTemporalMultiMap- Specified by:
periodSetin classAbstractTemporalMultiMap
valueSet
public java.util.Set valueSet()
- Description copied from interface:
TemporalMultiMap - Returns a read-only Set containing the values defined somewhen in this map.
- Specified by:
valueSetin interfaceTemporalMultiMap- Specified by:
valueSetin classAbstractTemporalMultiMap
valueSet
public java.util.Set valueSet(Instant instant)
- Description copied from interface:
TemporalMultiMap - Returns a read-only Set containing the values defined in this map at the
specified instant.
Returns an empty set if the map contains no mapping at this Instant.
- Specified by:
valueSetin interfaceTemporalMultiMap- Specified by:
valueSetin classAbstractTemporalMultiMap
clear
public void clear()
- Description copied from interface:
TemporalMultiMap - Removes all the mappings from this map (optional operation).
- Specified by:
clearin interfaceTemporalMultiMap- Specified by:
clearin classAbstractTemporalMultiMap
removeValue
public void removeValue(java.lang.Object value)
- Description copied from interface:
TemporalMultiMap - Removes all the mapping(s) for this value from this map if present (optional
operation).
- Specified by:
removeValuein interfaceTemporalMultiMap- Specified by:
removeValuein classAbstractTemporalMultiMap
remove
public boolean remove(Period p, java.lang.Object value)
- Description copied from interface:
TemporalMultiMap - Removes the mapping(s) for this period and value from this map if present
(optional operation).
- Specified by:
removein interfaceTemporalMultiMap- Specified by:
removein classAbstractTemporalMultiMap
removePeriod
public boolean removePeriod(Period p)
- Description copied from interface:
TemporalMultiMap - Removes all the mapping(s) for this period from this map if present (optional
operation).
- Specified by:
removePeriodin interfaceTemporalMultiMap- Specified by:
removePeriodin classAbstractTemporalMultiMap
put
public boolean put(Period p, java.lang.Object value)
- Description copied from interface:
TemporalMultiMap - Associates the specified value to the specified Period in this map.
If the map previously contained a mapping to the same value, during a period
overlapping this period, the periods are merged.
- Specified by:
putin interfaceTemporalMultiMap- Specified by:
putin classAbstractTemporalMultiMap
getTemporalUnaryMapOrNull
private TemporalUnaryMap getTemporalUnaryMapOrNull(java.lang.Object value)
getTemporalUnaryMap
private TemporalUnaryMap getTemporalUnaryMap(java.lang.Object value)
|
|||||||||
| Home >> All >> [ jtemporal overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC