org.jfree.data.general
Class Series
java.lang.Objectorg.jfree.data.general.Series
- Cloneable, Serializable
extends java.lang.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.
Series(Comparable key)- Creates a new series with the specified key.
|
Series(Comparable key, String description)- Creates a new series with the specified key and description.
|
void | addChangeListener(SeriesChangeListener listener)- Registers an object with this series, to receive notification whenever
the series changes.
|
void | addPropertyChangeListener(PropertyChangeListener listener)- Adds a property change listener to the series.
|
Object | clone()- Returns a clone of the series.
|
boolean | equals(Object obj)- Tests the series for equality with another object.
|
protected void | firePropertyChange(String property, Object oldValue, Object newValue)- Fires a property change event.
|
void | fireSeriesChanged()- General method for signalling to registered listeners that the series
has been changed.
|
String | getDescription()- Returns a description of the series.
|
abstract int | getItemCount()- Returns the number of data items in the series.
|
Comparable | getKey()- Returns the key for 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.
|
boolean | isEmpty()- Returns
true if the series contains no data items, and
false otherwise.
|
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(PropertyChangeListener listener)- Removes a property change listener from the series.
|
void | setDescription(String description)- Sets the description of the series and sends a
PropertyChangeEvent to all registered listeners.
|
void | setKey(Comparable key)- Sets the key for the series and sends a
PropertyChangeEvent
(with the property name "Key") to all registered listeners.
|
void | setNotify(boolean notify)- Sets the flag that controls whether or not change events are sent to
registered listeners.
|
Series
protected Series(Comparable key)
Creates a new series with the specified key.
key - the series key (null not permitted).
Series
protected Series(Comparable key,
String description) Creates a new series with the specified key and description.
key - the series key (null NOT permitted).description - the series description (null permitted).
addPropertyChangeListener
public void addPropertyChangeListener(PropertyChangeListener listener)
Adds a property change listener to the series.
clone
public Object clone()
throws CloneNotSupportedException Returns a clone of the series.
Notes:
- No need to clone the name or description, since String object is
immutable.
- We set the listener list to empty, since the listeners did not
register with the clone.
- Same applies to the PropertyChangeSupport instance.
equals
public boolean equals(Object obj)
Tests the series for equality with another object.
obj - the object (null permitted).
firePropertyChange
protected void firePropertyChange(String property,
Object oldValue,
Object newValue) Fires a property change event.
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.
- The series description (possibly
null).
getItemCount
public abstract int getItemCount()
Returns the number of data items in the series.
- The number of data items in the series.
getKey
public Comparable getKey()
Returns the key for the series.
- The series key (never
null).
getNotify
public boolean getNotify()
Returns the flag that controls whether or not change events are sent to
registered listeners.
hashCode
public int hashCode()
Returns a hash code.
isEmpty
public boolean isEmpty()
Returns true if the series contains no data items, and
false otherwise.
notifyListeners
protected void notifyListeners(SeriesChangeEvent event)
Sends a change event to all registered listeners.
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.
listener - the listener to deregister.
removePropertyChangeListener
public void removePropertyChangeListener(PropertyChangeListener listener)
Removes a property change listener from the series.
setDescription
public void setDescription(String description)
Sets the description of the series and sends a
PropertyChangeEvent to all registered listeners.
description - the description (null permitted).
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.
key - the key (null not permitted).
setNotify
public void setNotify(boolean notify)
Sets the flag that controls whether or not change events are sent to
registered listeners.
notify - the new value of the flag.