Header
And More


org.jfree.data.general
Class Series

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

public abstract 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 ("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.

See Also:
Serialized Form

Constructor Summary
protected Series(java.lang.Comparable key)
          Creates a new series with the specified key.
protected Series(java.lang.Comparable key, java.lang.String description)
          Creates a new series with the specified key and description.
 
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.
abstract  int getItemCount()
          Returns the number of data items in the series.
 java.lang.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(java.beans.PropertyChangeListener listener)
          Removes a property change listener from the series.
 void setDescription(java.lang.String description)
          Sets the description of the series and sends a PropertyChangeEvent to all registered listeners.
 void setKey(java.lang.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.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Series

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

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

Series

protected Series(java.lang.Comparable key,
                 java.lang.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

getKey

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

Returns:
The series key (never null).
See Also:
setKey(Comparable)

setKey

public void setKey(java.lang.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()

getDescription

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

Returns:
The series description (possibly null).
See Also:
setDescription(String)

setDescription

public void setDescription(java.lang.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()

getNotify

public boolean getNotify()
Returns the flag that controls whether or not 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 or not change events are sent to registered listeners.

Parameters:
notify - the new value of the flag.
See Also:
getNotify()

isEmpty

public boolean isEmpty()
Returns true if the series contains no data items, and false otherwise.

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 java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Returns a clone of the series.

Notes:

Overrides:
clone in class java.lang.Object
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.

Overrides:
equals in class java.lang.Object
Parameters:
obj - the object (null permitted).
Returns:
true or false.

hashCode

public int hashCode()
Returns a hash code.

Overrides:
hashCode in class java.lang.Object
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.

Footer
And More


Copyright © 2000-2009 by Object Refinery Limited. All Rights Reserved.