edu.ull.cgunay.plots
Class Profile

java.lang.Object
  |
  +--java.util.AbstractMap
        |
        +--java.util.TreeMap
              |
              +--edu.ull.cgunay.plots.Profile
All Implemented Interfaces:
Cloneable, Map, Observer, Serializable, SortedMap

public class Profile
extends TreeMap
implements Observer, Serializable

Records the (time) profile of a variable Profilable entity. Saves pairs consisting of a key (time) value and an associated value for the entity (its clone). The key consists of a simple Double value.

Created: Mon Apr 8 17:07:04 2002

Modified: $Date: 2002/12/17 00:58:56 $

Version:
$Revision: 1.9 $ for this file.
Author:
Cengiz Gunay
See Also:
ProfilePlot, Profilable, Grapher.profile(edu.ull.cgunay.plots.Profile, edu.ull.cgunay.plots.Range), Serialized Form

Field Summary
protected  Profilable entity
          Entity to be observed and recorded.
(package private) static double overhead
          Constant to be added to range expressions for making the end inlusive.
 
Fields inherited from class java.util.TreeMap
 
Fields inherited from class java.util.AbstractMap
 
Constructor Summary
Profile()
          Dummy constructor.
Profile(Profilable entity, Object time)
          Starts recording entity at given time.
 
Method Summary
 Collection collection(Range range)
          Returns an Collection for the entity values recorded in the given range.
 void connectTo(Profilable entity, Object time)
          Adds this object to the observer list of the entity and initializes the profile with given time-entity pair.
 Range getRange()
          Returns the maximum range of this profile, that is a range consisting of the minimum and maximum time entries.
 Iterator iterator(Range range)
          Returns an Iterator for the entity values recorded in the given range.
 void update(Observable entity, Object time)
          Called when notified of change of the entity.
 
Methods inherited from class java.util.TreeMap
clear, clone, comparator, containsKey, containsValue, entrySet, firstKey, get, headMap, keySet, lastKey, put, putAll, remove, size, subMap, tailMap, values
 
Methods inherited from class java.util.AbstractMap
equals, hashCode, isEmpty, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode, isEmpty
 

Field Detail

overhead

static final double overhead
Constant to be added to range expressions for making the end inlusive.

See Also:
Constant Field Values

entity

protected Profilable entity
Entity to be observed and recorded.

Constructor Detail

Profile

public Profile()
Dummy constructor.


Profile

public Profile(Profilable entity,
               Object time)
Starts recording entity at given time. Calls connectTo().

Parameters:
entity - to be observed and recorded
time - an Double value, used as hash key
See Also:
connectTo(edu.ull.cgunay.plots.Profilable, java.lang.Object)
Method Detail

connectTo

public void connectTo(Profilable entity,
                      Object time)
Adds this object to the observer list of the entity and initializes the profile with given time-entity pair.

Parameters:
entity - a Profilable value
time - an Object value

iterator

public Iterator iterator(Range range)
Returns an Iterator for the entity values recorded in the given range. If range is null the iterator is on all values of the entity contained in this Profile.

Parameters:
range - a Range value
Returns:
an Iterator value
See Also:
Grapher.profile(edu.ull.cgunay.plots.Profile, edu.ull.cgunay.plots.Range)

collection

public Collection collection(Range range)
Returns an Collection for the entity values recorded in the given range. If range is null the iterator is on all values of the entity contained in this Profile.

Parameters:
range - a Range value
Returns:
an Iterator value
See Also:
Grapher.profile(edu.ull.cgunay.plots.Profile, edu.ull.cgunay.plots.Range)

getRange

public Range getRange()
Returns the maximum range of this profile, that is a range consisting of the minimum and maximum time entries.

Returns:
a Range value

update

public void update(Observable entity,
                   Object time)
Called when notified of change of the entity.

Specified by:
update in interface Observer
Parameters:
entity - that changed
time - time of change