|
JTemporal Home Tutorial |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
V
- the type of the valuepublic interface TemporalSet<V>
This is a map, whose key is a Period when adding mappings (entries)
and an Instant when getting mappings.
Associates periods to a Set of objects (values).
This is typically used to implement temporal associations with non-unary cardinality,
for example Employee-Skills.
You can get the Set of values valid at a given time by calling
valueSet(Instant).
To add a mapping, you call put(Period, Object).
Note: the Object value (passed to many methods) must have equals and hashCode defined consistently, as described in the java.lang.Object documentation.
Method Summary | |
---|---|
void |
clear()
Removes all the mappings from this map. |
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 there is a mapping for the specified value. |
java.util.Set<TimedObject<V>> |
entrySet()
Returns a set view of the entries (instances of TimedObject) contained in this map. |
Period |
extent(java.lang.Object value)
Return a period enclosing firstInstant(value) and lastInstantvalue() |
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 given value. |
boolean |
isEmpty()
Returns true if this map contains no Period-value mappings. |
boolean |
isEmpty(Instant i)
Returns true if this map does not contain mappings valid at the given intant. |
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<Period> |
periodSet(java.lang.Object value)
Returns a set view of the periods contained in this map for the give value. |
boolean |
put(Period p,
V value)
Associates the specified value with the specified Period in this map. |
boolean |
putAll(TemporalSet<? extends V> ts)
Copies all of the mappings from the specified map to this map. |
boolean |
remove(Period p,
java.lang.Object value)
Removes the mapping(s) for this period and value from this map if present. |
boolean |
removePeriod(Period p)
Removes all the mapping(s) for this period from this map if present. |
boolean |
removeValue(java.lang.Object value)
Removes all the mapping(s) for this value from this map if present. |
int |
size()
Returns the number of Period-value mappings in this map. |
int |
sizeAt(Instant instant)
Returns the number values in this map valid at the given instant. |
int |
sizeFor(java.lang.Object value)
Returns the number of Period-value mappings in this map for the given value. |
int |
sizeValues()
Returns the number of distinct values in this map. |
java.util.Set<V> |
valueSet()
Returns a read-only Set containing the distinct values defined somewhen in this map. |
java.util.Set<V> |
valueSet(Instant instant)
Returns a read-only Set containing the values defined in this map at the specified instant. |
Method Detail |
---|
void clear()
java.lang.UnsupportedOperationException
- if clear is not supported by this map.int size()
int sizeValues()
int sizeFor(java.lang.Object value)
value
- the number of entries for the given value
int sizeAt(Instant instant)
instant
- the instant at which the counted entries are valid
boolean isEmpty()
boolean isEmpty(Instant i)
i
- when this temporal set is empty
java.util.Set<V> valueSet(Instant instant)
instant
- instant whose associated value is to be returned
java.util.Set<V> valueSet()
java.util.Set<TimedObject<V>> entrySet()
TimedObject
Period getPeriod(Instant instant, java.lang.Object value)
instant
- when the given value is validvalue
- the value of the entry valid during the returned period
boolean contains(Instant instant, java.lang.Object value)
instant
- instant whose presence in this map is to be tested.value
- value whose presence in this map is to be tested.
boolean containsValue(java.lang.Object value)
value
- value whose presence in this map is to be tested.
boolean put(Period p, V value)
p
- period with which the specified value is to be associated.value
- value to be associated with the specified period. Be careful
at the equals implementation of the value object: the result of the equals
method is supposed to be immutable while it is stored in this collection.
java.lang.UnsupportedOperationException
- if the put operation is
not supported by this map.
java.lang.ClassCastException
- if the class of the specified value
prevents it from being stored in this map.
java.lang.IllegalArgumentException
- if some aspect of this period or value
prevents it from being stored in this map.
or if the period or the value is nullboolean remove(Period p, java.lang.Object value)
p
- period whose mappings are to be removed from the map.value
- value whose mapping are to be removed from the map.
java.lang.UnsupportedOperationException
- if the remove method is
not supported by this map.
java.util.NoSuchElementException
- if the value is unknown.boolean removeValue(java.lang.Object value)
value
- value whose mapping are to be removed from the map.
true
if the TemporalSet contained the specified element.
java.lang.UnsupportedOperationException
- if the remove method is
not supported by this map.
java.util.NoSuchElementException
- if the value is unknown.boolean removePeriod(Period p)
p
- period whose mappings are to be removed from the map.
java.lang.UnsupportedOperationException
- if the remove method is
not supported by this map.boolean putAll(TemporalSet<? extends V> ts)
ts
- Mappings to be stored in this map.
java.lang.UnsupportedOperationException
- if the putAll method is
not supported by this map.
java.lang.ClassCastException
- if the class of a value in the
specified map prevents it from being stored in this map.
java.lang.IllegalArgumentException
- some aspect of a value in the
specified map prevents it from being stored in this map.java.util.Set<Period> periodSet(java.lang.Object value)
java.util.NoSuchElementException
- if the value is unknown.Instant firstInstant(java.lang.Object value)
java.util.NoSuchElementException
- if the value is unknown.Instant lastInstant(java.lang.Object value)
java.util.NoSuchElementException
- if the value is unknown.Period firstPeriod(java.lang.Object value)
java.util.NoSuchElementException
- if the value is unknown.Period lastPeriod(java.lang.Object value)
java.util.NoSuchElementException
- if the value is unknown.Period extent(java.lang.Object value)
java.util.NoSuchElementException
- if the value is unknown.firstInstant(Object)
,
lastInstant(Object)
|
JTemporal Home Tutorial |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |