org.jfree.data.general

Class Series

public abstract class Series extends Object implements Cloneable, Serializable

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

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

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

Constructor Summary
protected Series(Comparable key)
Creates a new series with the specified key.
protected Series(Comparable key, String description)
Creates a new series with the specified key and description.
Method Summary
voidaddChangeListener(SeriesChangeListener listener)
Registers an object with this series, to receive notification whenever the series changes.
voidaddPropertyChangeListener(PropertyChangeListener listener)
Adds a property change listener to the series.
Objectclone()
Returns a clone of the series.
booleanequals(Object obj)
Tests the series for equality with another object.
protected voidfirePropertyChange(String property, Object oldValue, Object newValue)
Fires a property change event.
voidfireSeriesChanged()
General method for signalling to registered listeners that the series has been changed.
StringgetDescription()
Returns a description of the series.
ComparablegetKey()
Returns the key for the series.
booleangetNotify()
Returns the flag that controls whether or not change events are sent to registered listeners.
inthashCode()
Returns a hash code.
protected voidnotifyListeners(SeriesChangeEvent event)
Sends a change event to all registered listeners.
voidremoveChangeListener(SeriesChangeListener listener)
Deregisters an object, so that it not longer receives notification whenever the series changes.
voidremovePropertyChangeListener(PropertyChangeListener listener)
Removes a property change listener from the series.
voidsetDescription(String description)
Sets the description of the series and sends a PropertyChangeEvent to all registered listeners.
voidsetKey(Comparable key)
Sets the key for the series and sends a PropertyChangeEvent (with the property name "Key") to all registered listeners.
voidsetNotify(boolean notify)
Sets the flag that controls whether or not change events are sent to registered listeners.

Constructor Detail

Series

protected Series(Comparable key)
Creates a new series with the specified key.

Parameters: key the series key (null not permitted).

Series

protected Series(Comparable key, String description)
Creates a new series with the specified key and description.

Parameters: key the series key (null NOT permitted). description the series description (null permitted).

Method Detail

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.

addPropertyChangeListener

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

Parameters: listener the listener.

clone

public Object clone()
Returns a clone of the series.

Notes:

Returns: A clone of the series.

Throws: CloneNotSupportedException not thrown by this class, but subclasses may differ.

equals

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

Parameters: obj the object (null permitted).

Returns: true or false.

firePropertyChange

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

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

fireSeriesChanged

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

getDescription

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

Returns: The series description (possibly null).

See Also: setDescription

getKey

public Comparable getKey()
Returns the key for the series.

Returns: The series key (never null).

See Also: setKey

getNotify

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

Returns: A boolean.

See Also: Series

hashCode

public int hashCode()
Returns a hash code.

Returns: A hash code.

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.

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.

removePropertyChangeListener

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

Parameters: listener The listener.

setDescription

public void setDescription(String description)
Sets the description of the series and sends a PropertyChangeEvent to all registered listeners.

Parameters: description the description (null permitted).

See Also: getDescription

setKey

public void setKey(Comparable key)
Sets the key for the series and sends a PropertyChangeEvent (with the property name "Key") to all registered listeners.

Parameters: key the key (null not permitted).

See Also: getKey

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.

See Also: getNotify