|
JTemporal Home Tutorial |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.jtemporal.spi.ORMTemporalAttributeStorage<V>
public class ORMTemporalAttributeStorage<V>
An implementation of TemporalAttributeStorage#, based on a TreeMap, mapped by an ORM tool.
Constructor Summary | |
---|---|
ORMTemporalAttributeStorage(java.util.SortedMap<Period,TimedObject<V>> sortedMap,
TimedObjectFactory<V> toFactory)
You specify an instance of SortedMap to be used internally by the storage. |
Method Summary | |
---|---|
void |
beginAtomicOperation()
Tells the storage that the JTemporal client is calling a method that can result in multiples updates in the storage. |
void |
clear()
Removes all the stored mappings. |
boolean |
containsValue(java.lang.Object value)
Returns true if this map maps one or more Periods to the specified value. |
boolean |
containsValue(java.lang.Object value,
Period range)
Returns true if this map maps one or more Periods to the specified value, during the specified period. |
void |
endAtomicOperation()
Tells the storage that an atomic operation has finished. |
CloseableIterator |
entryIterator()
Iterates over all the entries of the storage. |
CloseableIterator |
entryIterator(Period range)
Iterates over all the entries of the storage that intersects the period P. |
Period |
firstPeriod()
Returns the first (lowest) period currently in this storage. |
Period |
firstPeriod(Period range)
Returns the first (lowest) period currently in this storage, that intersects the given period. |
TimedObject |
getEntry(Instant instant)
Returns the entry valid at the given instant, if any is found. |
TimedObject |
getEntryEndingAt(Instant instant)
Returns the entry finishing exactly at the given instant, if any is found. |
TimedObject |
getEntryStartingAt(Instant instant)
Returns the entry starting exactly at the given instant, if any is found. |
Period |
getPeriod(Instant instant)
Returns the period that encloses the given instant, if any is found. |
V |
getValue(Instant instant)
Returns the value to which this map maps the specified Instant. |
boolean |
isEmpty()
Returns true if this storage does not contain objects. |
boolean |
isEmpty(Period range)
Returns true if this storage does not contain objects intersecting the given period. |
Period |
lastPeriod()
Returns the last (highest) period currently in this storage. |
Period |
lastPeriod(Period range)
Returns the last (highest) period currently in this storage, that intersects the given period. |
CloseableIterator |
periodIterator()
Iterates over all the periods of the storage. |
CloseableIterator |
periodIterator(Period range)
Iterates over all the periods of the storage that intersects the period P. |
void |
put(Period p,
java.lang.Object value)
Stores a mapping (entry, tuple, row) composed by period and value. |
void |
removeEntry(Period p)
Removes an entry composed by period and value previously stored. |
int |
removeRange(Period range)
Removes all the entries whose period indersects the given period. |
int |
size()
Returns the number of Period-value mappings in this map. |
int |
size(Period range)
Returns the number of Period-value mappings in this map, for the given priod. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ORMTemporalAttributeStorage(java.util.SortedMap<Period,TimedObject<V>> sortedMap, TimedObjectFactory<V> toFactory)
sortedMap
- a map mapped by an ORM tools, whose key is composed
of Period and the value of TimedObject, using as a comparator
StartComparator.COMPARATOR. Note that the getValue(Instant)
will return just the value held in the TimedObject and not the timedObject itself.
This, because the TimedObject is the closed representation of a row in
your database, that is mapped by your ORM tool.toFactory
- a callback for creating and destroying instances of TimedObject
java.lang.IllegalArgumentException
- if the map does not use StartComparator.COMPARATOR.
or if the map is nullMethod Detail |
---|
public Period lastPeriod()
TemporalAttributeStorage
lastPeriod
in interface TemporalAttributeStorage
public Period lastPeriod(Period range)
TemporalAttributeStorage
lastPeriod
in interface TemporalAttributeStorage
range
- the intersecting period
public Period firstPeriod()
TemporalAttributeStorage
firstPeriod
in interface TemporalAttributeStorage
public Period firstPeriod(Period range)
TemporalAttributeStorage
firstPeriod
in interface TemporalAttributeStorage
range
- the intersecting period
public boolean isEmpty()
TemporalAttributeStorage
isEmpty
in interface TemporalAttributeStorage
public V getValue(Instant instant)
TemporalAttributeStorage
getValue
in interface TemporalAttributeStorage
instant
- instant whose associated value is to be returned
public Period getPeriod(Instant instant)
TemporalAttributeStorage
getPeriod
in interface TemporalAttributeStorage
instant
- instant whose associated value is to be returned
public TimedObject getEntry(Instant instant)
TemporalAttributeStorage
getEntry
in interface TemporalAttributeStorage
instant
- instant whose associated value is to be returned
public TimedObject getEntryEndingAt(Instant instant)
TemporalAttributeStorage
getEntryEndingAt
in interface TemporalAttributeStorage
instant
- the instant the equals the entry end
public TimedObject getEntryStartingAt(Instant instant)
TemporalAttributeStorage
getEntryStartingAt
in interface TemporalAttributeStorage
instant
- the instant the equals the entry end
public void beginAtomicOperation()
TemporalAttributeStorage
beginAtomicOperation
in interface TemporalAttributeStorage
TemporalAttributeStorage.endAtomicOperation()
public void endAtomicOperation()
TemporalAttributeStorage
endAtomicOperation
in interface TemporalAttributeStorage
TemporalAttributeStorage.beginAtomicOperation()
public void clear()
TemporalAttributeStorage
clear
in interface TemporalAttributeStorage
public int size()
TemporalAttributeStorage
size
in interface TemporalAttributeStorage
public int size(Period range)
TemporalAttributeStorage
size
in interface TemporalAttributeStorage
range
- the intersecting period
public boolean isEmpty(Period range)
TemporalAttributeStorage
isEmpty
in interface TemporalAttributeStorage
range
- the intersecting period
public boolean containsValue(java.lang.Object value)
TemporalAttributeStorage
containsValue
in interface TemporalAttributeStorage
value
- value whose presence in this map is to be tested.
public boolean containsValue(java.lang.Object value, Period range)
TemporalAttributeStorage
containsValue
in interface TemporalAttributeStorage
value
- value whose presence in this map is to be tested.range
- the period intersecting the value mappings
public void put(Period p, java.lang.Object value)
TemporalAttributeStorage
put
in interface TemporalAttributeStorage
p
- period with which the specified value is associated. Cannot be null.value
- value to be associated with the specified key. Cannot be null.public CloseableIterator entryIterator()
TemporalAttributeStorage
entryIterator
in interface TemporalAttributeStorage
TimedObject
public CloseableIterator entryIterator(Period range)
TemporalAttributeStorage
entryIterator
in interface TemporalAttributeStorage
range
- the intersecting period.
TimedObject
public CloseableIterator periodIterator()
TemporalAttributeStorage
periodIterator
in interface TemporalAttributeStorage
Period
public CloseableIterator periodIterator(Period range)
TemporalAttributeStorage
periodIterator
in interface TemporalAttributeStorage
range
- the intersecting period.
Period
public void removeEntry(Period p)
TemporalAttributeStorage
removeEntry
in interface TemporalAttributeStorage
p
- period whose mapping is to be removed from the storage. It
must exactly match the key of an existing entry.public int removeRange(Period range)
TemporalAttributeStorage
removeRange
in interface TemporalAttributeStorage
range
- the period specifying that range whose interecting entries are
to be deleted.
public java.lang.String toString()
toString
in class java.lang.Object
|
JTemporal Home Tutorial |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |