JTemporal Home
Tutorial

net.sf.jtemporal
Class TreeTemporalAttribute<V>

java.lang.Object
  extended by net.sf.jtemporal.AbstractTemporalAttribute<V>
      extended by net.sf.jtemporal.TemporalAttributeImpl<V>
          extended by net.sf.jtemporal.TreeTemporalAttribute<V>
Type Parameters:
V - the type of the value
All Implemented Interfaces:
java.io.Serializable, ReadableTemporalAttribute<V>, TemporalAttribute<V>

public class TreeTemporalAttribute<V>
extends TemporalAttributeImpl<V>
implements java.io.Serializable

Uses internally a TreeMap to store the mappings. The Periods as used as keys.
Links at any time an object (the map holder) to zero or one object (value), example: Employee-Salary. You get the value valid at a given time with the method Object get(Instant i). To add a mapping, you do not specify an Instant, but a Period specifying the validity of the object. If another object exists valid during this period, the validity will be overwritten for new object period.
Note that this implementation is not synchronized. If multiple threads access a 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 Collections.synchronizedMap method. This is best done at creation time, to prevent accidental unsynchronized access to the map:

     TemporalAttribute tm = SynchronizedTemporalMap.getInstance(new TreeTemporalSet(...));
 


Actually, this is just a TemporalAttributeImpl instance using a TreeTemporalAttributeStorage as a storage.

Version:
$Id: TreeTemporalAttribute.java,v 1.10 2007/09/14 20:03:10 tabeck Exp $
See Also:
TemporalAttributeImpl, TreeTemporalAttributeStorage, Serialized Form

Constructor Summary
TreeTemporalAttribute()
           
 
Method Summary
 
Methods inherited from class net.sf.jtemporal.TemporalAttributeImpl
clear, containsInstant, containsValue, entrySet, firstInstant, firstPeriod, get, getEntry, getPeriod, getStorage, isEmpty, lastInstant, lastPeriod, periodSet, put, remove, size, subMap, toString
 
Methods inherited from class net.sf.jtemporal.AbstractTemporalAttribute
equals, extent, putAll
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TreeTemporalAttribute

public TreeTemporalAttribute()

JTemporal Home
Tutorial