JTemporal Home
Tutorial

net.sf.jtemporal
Class AbstractTemporalAttribute<V>

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

public abstract class AbstractTemporalAttribute<V>
extends java.lang.Object
implements TemporalAttribute<V>

Features common to the TemporalAttributes.

Version:
$Id: AbstractTemporalAttribute.java,v 1.8 2007/09/14 20:03:08 tabeck Exp $

Constructor Summary
AbstractTemporalAttribute()
           
 
Method Summary
 boolean equals(java.lang.Object o)
          Compares the specified object with this map for content equality.
 Period extent()
          Returns a period enclosing firstInstant() and lastInstant()
 TimedObject<V> getEntry(Instant instant)
          Returns the entry active at the given instant.
 boolean putAll(TemporalAttribute<? extends V> tm)
          Copies all of the mappings from the specified map to this map (optional operation).
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.sf.jtemporal.TemporalAttribute
clear, containsInstant, containsValue, entrySet, firstInstant, firstPeriod, get, getPeriod, isEmpty, lastInstant, lastPeriod, periodSet, put, remove, size, subMap
 

Constructor Detail

AbstractTemporalAttribute

public AbstractTemporalAttribute()
Method Detail

putAll

public boolean putAll(TemporalAttribute<? extends V> tm)
Description copied from interface: TemporalAttribute
Copies all of the mappings from the specified map to this map (optional operation). These mappings will replace any mappings that this map had for any of the periods currently in the specified map.

Specified by:
putAll in interface TemporalAttribute<V>
Parameters:
tm - Mappings to be stored in this map.
Returns:
true if one or more previous values are overwritten partially or completely. false if there is any conflicting mapping.

extent

public Period extent()
Description copied from interface: TemporalAttribute
Returns a period enclosing firstInstant() and lastInstant()

Specified by:
extent in interface TemporalAttribute<V>
Returns:
new Period(firstInstant(), lastInstant())
See Also:
TemporalAttribute.firstInstant(), TemporalAttribute.lastInstant()

getEntry

public TimedObject<V> getEntry(Instant instant)
Description copied from interface: TemporalAttribute
Returns the entry active at the given instant.
This method is like a get(Instant) and getPeriod(Instant) in a single shot.
WARNING: for defragmentation purposes, this method may eventually return a different instance of value that equals the value stored by put(Period).

Specified by:
getEntry in interface TemporalAttribute<V>
Parameters:
instant - instant whose associated entry is to be returned
Returns:
the entry active at the given instant. returns null if this map does not contain a mapping for the specified instant.

equals

public boolean equals(java.lang.Object o)
Compares the specified object with this map for content equality. Returns true if the given object contains the same mappings.
This implementation first checks if the specified object is this map; if so it returns true. Then, it checks if the specified object is a map whose size is identical to the size of this set; if not, it it returns false. If so, it iterates over this map's Periods and Values, and checks them for equality.
The method equals is not overridden in order to keep the default hashcode() method. Overriding hashcode() would lead to poor performances when adding this map to a hashmap (which is done by the TemporalSet).

Overrides:
equals in class java.lang.Object
Parameters:
o - object to be compared for equality with this map.
Returns:
true if the specified object is equal to this map.

JTemporal Home
Tutorial