- java.lang.Object
-
- org.jfree.data.general.Series<K>
-
- All Implemented Interfaces:
Serializable,Cloneable
- Direct Known Subclasses:
ComparableObjectSeries,MatrixSeries,TaskSeries,TimePeriodValues,TimeSeries,XYSeries
public abstract class Series<K extends Comparable<K>> 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
SeriesChangeListenerto receive notification of changes to the series data.- See Also:
- Serialized Form
-
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaddChangeListener(SeriesChangeListener listener)Registers an object with this series, to receive notification whenever the series changes.Objectclone()Returns a clone of the series.booleanequals(Object obj)Tests the series for equality with another object.voidfireSeriesChanged()General method for signalling to registered listeners that the series has been changed.abstract intgetItemCount()Returns the number of data items in the series.KgetKey()Returns the key for the series.booleangetNotify()Returns the flag that controls whether change events are sent to registered listeners.inthashCode()Returns a hash code.booleanisEmpty()Returnstrueif the series contains no data items, andfalseotherwise.protected voidnotifyListeners(SeriesChangeEvent event)Sends a change event to all registered listeners.voidremoveChangeListener(SeriesChangeListener listener)Deregisters an object, so that it no longer receives notification whenever the series changes.voidsetNotify(boolean notify)Sets the flag that controls whether change events are sent to registered listeners.
-
-
-
Method Detail
-
getNotify
public boolean getNotify()
Returns the flag that controls whether change events are sent to registered listeners.- Returns:
- A boolean.
- See Also:
setNotify(boolean)
-
setNotify
public void setNotify(boolean notify)
Sets the flag that controls whether change events are sent to registered listeners.- Parameters:
notify- the new value of the flag.- See Also:
getNotify()
-
isEmpty
public boolean isEmpty()
Returnstrueif the series contains no data items, andfalseotherwise.- Returns:
- A boolean.
- Since:
- 1.0.7
-
getItemCount
public abstract int getItemCount()
Returns the number of data items in the series.- Returns:
- The number of data items in 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.
- Overrides:
clonein classObject- Returns:
- A clone of the series.
- Throws:
CloneNotSupportedException- not thrown by this class, but subclasses may differ.
-
hashCode
public int hashCode()
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
SeriesChangeListenerinterface.- Parameters:
listener- the listener to register.
-
removeChangeListener
public void removeChangeListener(SeriesChangeListener listener)
Deregisters an object, so that it no 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.
-
-