JTemporal Home
Tutorial

net.sf.jtemporal.spi
Interface LazyTemporalAttributeStorage.MissingRangeHandler<V>

Type Parameters:
V - the value held in the related LazyTemporalAttributeStorage
Enclosing class:
LazyTemporalAttributeStorage<V>

public static interface LazyTemporalAttributeStorage.MissingRangeHandler<V>

Loads the data from the real physical storage into the the LazyTemporalAttributeStorage cache, when additional data is requested.

Version:
$Id: LazyTemporalAttributeStorage.java,v 1.17 2007/09/14 20:03:11 tabeck Exp $

Method Summary
 Period getAlwaysPeriod()
          JTemporal does not know what your implementation of Instant is.
 void populateEntryEndingAt(LazyTemporalAttributeStorage<V> target, Instant instant)
          When the LazyTemporalAttributeStorage calls you back using this method you have to:
1- load the entry when end instant is equal to instant, if any exists.
 void populateRange(LazyTemporalAttributeStorage<V> target, Period range)
          When the LazyTemporalAttributeStorage calls you back using this method you have to:
1- Populate at least this storage with at least all the entries existing intersecting the given period (=range), by calling the method LazyTemporalAttributeStorage.putInCache(Period, Object)
It does not matter if you reload already loaded records, provided that they are identical.
 

Method Detail

populateRange

void populateRange(LazyTemporalAttributeStorage<V> target,
                   Period range)
When the LazyTemporalAttributeStorage calls you back using this method you have to:
1- Populate at least this storage with at least all the entries existing intersecting the given period (=range), by calling the method LazyTemporalAttributeStorage.putInCache(Period, Object)
It does not matter if you reload already loaded records, provided that they are identical.
It is recommended, but not required, to load a little bit further in the pas than range.getStart(). This will improve your performance by reducing subsequent loads, and will completely avoid calls to #populateEntryEndingAt(Instant).
2- Call the method LazyTemporalAttributeStorage.populated(Period) to tell which range you have actually populated (maybe you have populated more than requested to improve future caching.
This is needed, because LazyTemporalAttributeStorage must differentiate holes in cache from holes in the underlying storage.

Parameters:
target - the LazyTemporalAttributeStorage requesting to pe populated.
period - the range that must be populated. If there are holes, the LazyTemporalAttributeStorage assumes there are no mapping in the underlying storage as well: the holes are part of the information that is cached.

populateEntryEndingAt

void populateEntryEndingAt(LazyTemporalAttributeStorage<V> target,
                           Instant instant)
When the LazyTemporalAttributeStorage calls you back using this method you have to:
1- load the entry when end instant is equal to instant, if any exists. You are free to load more data if you wish. To load the entry you have to call the method LazyTemporalAttributeStorage.putInCache(Period, Object)
2- if you have loaded more data than the one just requested, you have to call LazyTemporalAttributeStorage.populated(Period) to tell up to which instant you have loaded.

Note : this method is called only when the LazyTemporalAttributeStorage is used in write mode. It is never called if you use it in read only mode.

Parameters:
target - the LazyTemporalAttributeStorage requesting to pe populated.
instant - the instant that must match to the end instant of the loaded entry

getAlwaysPeriod

Period getAlwaysPeriod()
JTemporal does not know what your implementation of Instant is. In order to be able to construct open-ended periods, it needs to get your infinity instant values.

Returns:
a constant (you could call it ALWAYS) containing a Period(NEGATIVE_INFINITY,POSITIVE_INFINITY)

JTemporal Home
Tutorial