org.jfree.data.general
Class Series

java.lang.Object
  extended byorg.jfree.data.general.Series
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable
Direct Known Subclasses:
MatrixSeries, TaskSeries, TimePeriodValues, TimeSeries, XYSeries

public class Series
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable

Base class representing a data series. Subclasses are left to implement the actual data structures.

The series has two properties ("Name" and "Description") for which you can register a PropertyChangeListener.

You can also register a SeriesChangeListener to receive notification of changes to the series data.

See Also:
Serialized Form

Constructor Summary
protected Series(java.lang.String name)
          Creates a new series.
protected Series(java.lang.String name, java.lang.String description)
          Constructs a series.
 
Method Summary
 void addChangeListener(SeriesChangeListener listener)
          Registers an object with this series, to receive notification whenever the series changes.
 void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
          Adds a property change listener to the series.
 java.lang.Object clone()
          Returns a clone of the series.
 boolean equals(java.lang.Object obj)
          Tests the series for equality with another object.
protected  void firePropertyChange(java.lang.String property, java.lang.Object oldValue, java.lang.Object newValue)
          Fires a property change event.
 void fireSeriesChanged()
          General method for signalling to registered listeners that the series has been changed.
 java.lang.String getDescription()
          Returns a description of the series.
 java.lang.String getName()
          Returns the name of the series.
 boolean getNotify()
          Returns the flag that controls whether or not change events are sent to registered listeners.
 int hashCode()
          Returns a hash code.
protected  void notifyListeners(SeriesChangeEvent event)
          Sends a change event to all registered listeners.
 void removeChangeListener(SeriesChangeListener listener)
          Deregisters an object, so that it not longer receives notification whenever the series changes.
 void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
          Removes a property change listener from the series.
 void setDescription(java.lang.String description)
          Sets the description of the series.
 void setName(java.lang.String name)
          Sets the name of the series.
 void setNotify(boolean notify)
          Sets the flag that controls whether or not change events are sent to registered listeners.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Series

protected Series(java.lang.String name)
Creates a new series.

Parameters:
name - the series name (null not permitted).

Series

protected Series(java.lang.String name,
                 java.lang.String description)
Constructs a series.

Parameters:
name - the series name (null NOT permitted).
description - the series description (null permitted).
Method Detail

getName

public java.lang.String getName()
Returns the name of the series.

Returns:
the series name (never null).

setName

public void setName(java.lang.String name)
Sets the name of the series.

Parameters:
name - the name (null not permitted).

getDescription

public java.lang.String getDescription()
Returns a description of the series.

Returns:
the series description (possibly null).

setDescription

public void setDescription(java.lang.String description)
Sets the description of the series.

Parameters:
description - the description (null permitted).

getNotify

public boolean getNotify()
Returns the flag that controls whether or not change events are sent to registered listeners.

Returns:
a boolean.

setNotify

public void setNotify(boolean notify)
Sets the flag that controls whether or not change events are sent to registered listeners.

Parameters:
notify - the new value of the flag.

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Returns a clone of the series.

Notes: 1. No need to clone the name or description, since String object is immutable. 2. We set the listener list to empty, since the listeners did not register with the clone. 3. Same applies to the PropertyChangeSupport instance.

Returns:
a clone of the series.
Throws:
java.lang.CloneNotSupportedException - not thrown by this class, but subclasses may differ.

equals

public boolean equals(java.lang.Object obj)
Tests the series for equality with another object.

Parameters:
obj - the object.
Returns:
true or false.

hashCode

public int hashCode()
Returns a hash code.

Returns:
a hash code.

addChangeListener

public void addChangeListener(SeriesChangeListener listener)
Registers an object with this series, to receive notification whenever the series changes.

Objects being registered must implement the SeriesChangeListener interface.

Parameters:
listener - the listener to register.

removeChangeListener

public void removeChangeListener(SeriesChangeListener listener)
Deregisters an object, so that it not longer receives notification whenever the series changes.

Parameters:
listener - the listener to deregister.

fireSeriesChanged

public void fireSeriesChanged()
General method for signalling to registered listeners that the series has been changed.


notifyListeners

protected void notifyListeners(SeriesChangeEvent event)
Sends a change event to all registered listeners.

Parameters:
event - Contains information about the event that triggered the notification.

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Adds a property change listener to the series.

Parameters:
listener - The listener.

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Removes a property change listener from the series.

Parameters:
listener - The listener.

firePropertyChange

protected void firePropertyChange(java.lang.String property,
                                  java.lang.Object oldValue,
                                  java.lang.Object newValue)
Fires a property change event.

Parameters:
property - the property key.
oldValue - the old value.
newValue - the new value.