org.jfree.data
Class XYSeriesCollection

java.lang.Object
  |
  +--org.jfree.data.AbstractDataset
        |
        +--org.jfree.data.AbstractSeriesDataset
              |
              +--org.jfree.data.XYSeriesCollection
All Implemented Interfaces:
Dataset, java.io.Serializable, SeriesChangeListener, SeriesDataset, XYDataset

public class XYSeriesCollection
extends AbstractSeriesDataset
implements XYDataset, java.io.Serializable

Represents a collection of XY series that can be used as a dataset.

Author:
David Gilbert
See Also:
Serialized Form

Constructor Summary
XYSeriesCollection()
          Constructs an empty dataset.
XYSeriesCollection(XYSeries series)
          Constructs a dataset and populates it with a single time series.
 
Method Summary
 void addSeries(XYSeries series)
          Adds a series to the collection.
 boolean equals(java.lang.Object obj)
          Tests this collection for equality with an arbitrary object.
 int getItemCount(int series)
          Returns the number of items in the specified series.
 XYSeries getSeries(int series)
          Returns a series.
 int getSeriesCount()
          Returns the number of series in the collection.
 java.lang.String getSeriesName(int series)
          Returns the name of a series.
 java.lang.Number getXValue(int series, int item)
          Returns the x-value for the specified series and item.
 java.lang.Number getYValue(int series, int index)
          Returns the y-value for the specified series and item.
 void removeAllSeries()
          Removes all the series from the collection.
 void removeSeries(int series)
          Removes a series from the collection.
 void removeSeries(XYSeries series)
          Removes a series from the collection.
 
Methods inherited from class org.jfree.data.AbstractSeriesDataset
seriesChanged
 
Methods inherited from class org.jfree.data.AbstractDataset
addChangeListener, fireDatasetChanged, getGroup, notifyListeners, removeChangeListener, setGroup
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jfree.data.Dataset
addChangeListener, getGroup, removeChangeListener, setGroup
 

Constructor Detail

XYSeriesCollection

public XYSeriesCollection()
Constructs an empty dataset.


XYSeriesCollection

public XYSeriesCollection(XYSeries series)
Constructs a dataset and populates it with a single time series.

Parameters:
series - the time series.
Method Detail

addSeries

public void addSeries(XYSeries series)
Adds a series to the collection.

Notifies all registered listeners that the dataset has changed.

Parameters:
series - the series.

getSeriesCount

public int getSeriesCount()
Returns the number of series in the collection.

Specified by:
getSeriesCount in interface SeriesDataset
Specified by:
getSeriesCount in class AbstractSeriesDataset
Returns:
the number of series in the collection.

getSeries

public XYSeries getSeries(int series)
Returns a series.

Parameters:
series - the series (zero-based index).
Returns:
The series.

getSeriesName

public java.lang.String getSeriesName(int series)
Returns the name of a series.

Specified by:
getSeriesName in interface SeriesDataset
Specified by:
getSeriesName in class AbstractSeriesDataset
Parameters:
series - the series (zero-based index).
Returns:
the name of a series.

getItemCount

public int getItemCount(int series)
Returns the number of items in the specified series.

Specified by:
getItemCount in interface XYDataset
Parameters:
series - the series (zero-based index).
Returns:
the number of items in the specified series.

getXValue

public java.lang.Number getXValue(int series,
                                  int item)
Returns the x-value for the specified series and item.

Specified by:
getXValue in interface XYDataset
Parameters:
series - the series (zero-based index).
item - the item (zero-based index).
Returns:
the x-value for the specified series and item.

getYValue

public java.lang.Number getYValue(int series,
                                  int index)
Returns the y-value for the specified series and item.

Specified by:
getYValue in interface XYDataset
Parameters:
series - the series (zero-based index).
index - the index of the item of interest (zero-based).
Returns:
the y-value for the specified series and item.

removeAllSeries

public void removeAllSeries()
Removes all the series from the collection.

Notifies all registered listeners that the dataset has changed.


removeSeries

public void removeSeries(XYSeries series)
Removes a series from the collection.

Notifies all registered listeners that the dataset has changed.

Parameters:
series - the series.

removeSeries

public void removeSeries(int series)
Removes a series from the collection.

Notifies all registered listeners that the dataset has changed.

Parameters:
series - the series (zero based index).

equals

public boolean equals(java.lang.Object obj)
Tests this collection for equality with an arbitrary object.

Overrides:
equals in class java.lang.Object
Parameters:
obj - the object.
Returns:
A boolean.