org.jfree.data.xy

Class XYSeriesCollection

public class XYSeriesCollection extends AbstractIntervalXYDataset implements IntervalXYDataset, DomainInfo, PublicCloneable, Serializable

Represents a collection of XYSeries objects that can be used as a dataset.
Constructor Summary
XYSeriesCollection()
Constructs an empty dataset.
XYSeriesCollection(XYSeries series)
Constructs a dataset and populates it with a single series.
Method Summary
voidaddSeries(XYSeries series)
Adds a series to the collection and sends a DatasetChangeEvent to all registered listeners.
Objectclone()
Returns a clone of this instance.
booleanequals(Object obj)
Tests this collection for equality with an arbitrary object.
RangegetDomainBounds(boolean includeInterval)
Returns the range of the values in this dataset's domain.
doublegetDomainLowerBound(boolean includeInterval)
Returns the minimum x-value in the dataset.
doublegetDomainUpperBound(boolean includeInterval)
Returns the maximum x-value in the dataset.
NumbergetEndX(int series, int item)
Returns the ending X value for the specified series and item.
NumbergetEndY(int series, int item)
Returns the ending Y value for the specified series and item.
doublegetIntervalPositionFactor()
Returns the interval position factor.
doublegetIntervalWidth()
Returns the interval width.
intgetItemCount(int series)
Returns the number of items in the specified series.
ListgetSeries()
Returns a list of all the series in the collection.
XYSeriesgetSeries(int series)
Returns a series from the collection.
XYSeriesgetSeries(Comparable key)
Returns a series from the collection.
intgetSeriesCount()
Returns the number of series in the collection.
ComparablegetSeriesKey(int series)
Returns the key for a series.
NumbergetStartX(int series, int item)
Returns the starting X value for the specified series and item.
NumbergetStartY(int series, int item)
Returns the starting Y value for the specified series and item.
NumbergetX(int series, int item)
Returns the x-value for the specified series and item.
NumbergetY(int series, int index)
Returns the y-value for the specified series and item.
inthashCode()
Returns a hash code.
intindexOf(XYSeries series)
Returns the index of the specified series, or -1 if that series is not present in the dataset.
booleanisAutoWidth()
Returns whether the interval width is automatically calculated or not.
voidremoveAllSeries()
Removes all the series from the collection and sends a DatasetChangeEvent to all registered listeners.
voidremoveSeries(int series)
Removes a series from the collection and sends a DatasetChangeEvent to all registered listeners.
voidremoveSeries(XYSeries series)
Removes a series from the collection and sends a DatasetChangeEvent to all registered listeners.
voidsetAutoWidth(boolean b)
Sets the flag that indicates wether the interval width is automatically calculated or not.
voidsetIntervalPositionFactor(double factor)
Sets the interval position factor.
voidsetIntervalWidth(double width)
Sets the interval width and sends a DatasetChangeEvent to all registered listeners.

Constructor Detail

XYSeriesCollection

public XYSeriesCollection()
Constructs an empty dataset.

XYSeriesCollection

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

Parameters: series the series (null ignored).

Method Detail

addSeries

public void addSeries(XYSeries series)
Adds a series to the collection and sends a DatasetChangeEvent to all registered listeners.

Parameters: series the series (null not permitted).

clone

public Object clone()
Returns a clone of this instance.

Returns: A clone.

Throws: CloneNotSupportedException if there is a problem.

equals

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

Parameters: obj the object (null permitted).

Returns: A boolean.

getDomainBounds

public Range getDomainBounds(boolean includeInterval)
Returns the range of the values in this dataset's domain.

Parameters: includeInterval a flag that determines whether or not the x-interval is taken into account.

Returns: The range.

getDomainLowerBound

public double getDomainLowerBound(boolean includeInterval)
Returns the minimum x-value in the dataset.

Parameters: includeInterval a flag that determines whether or not the x-interval is taken into account.

Returns: The minimum value.

getDomainUpperBound

public double getDomainUpperBound(boolean includeInterval)
Returns the maximum x-value in the dataset.

Parameters: includeInterval a flag that determines whether or not the x-interval is taken into account.

Returns: The maximum value.

getEndX

public Number getEndX(int series, int item)
Returns the ending X value for the specified series and item.

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

Returns: The ending X value.

getEndY

public Number getEndY(int series, int item)
Returns the ending Y value for the specified series and item.

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

Returns: The ending Y value.

getIntervalPositionFactor

public double getIntervalPositionFactor()
Returns the interval position factor.

Returns: The interval position factor.

getIntervalWidth

public double getIntervalWidth()
Returns the interval width. This is used to calculate the start and end x-values, if/when the dataset is used as an IntervalXYDataset.

Returns: The interval width.

getItemCount

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

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

Returns: The item count.

Throws: IllegalArgumentException if series is not in the range 0 to getSeriesCount() - 1.

getSeries

public List getSeries()
Returns a list of all the series in the collection.

Returns: The list (which is unmodifiable).

getSeries

public XYSeries getSeries(int series)
Returns a series from the collection.

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

Returns: The series.

Throws: IllegalArgumentException if series is not in the range 0 to getSeriesCount() - 1.

getSeries

public XYSeries getSeries(Comparable key)
Returns a series from the collection.

Parameters: key the key (null not permitted).

Returns: The series with the specified key.

Throws: UnknownKeyException if key is not found in the collection.

Since: 1.0.9

getSeriesCount

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

Returns: The series count.

getSeriesKey

public Comparable getSeriesKey(int series)
Returns the key for a series.

Parameters: series the series index (in the range 0 to getSeriesCount() - 1).

Returns: The key for a series.

Throws: IllegalArgumentException if series is not in the specified range.

getStartX

public Number getStartX(int series, int item)
Returns the starting X value for the specified series and item.

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

Returns: The starting X value.

getStartY

public Number getStartY(int series, int item)
Returns the starting Y value for the specified series and item.

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

Returns: The starting Y value.

getX

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

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

Returns: The value.

getY

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

Parameters: series the series (zero-based index). index the index of the item of interest (zero-based).

Returns: The value (possibly null).

hashCode

public int hashCode()
Returns a hash code.

Returns: A hash code.

indexOf

public int indexOf(XYSeries series)
Returns the index of the specified series, or -1 if that series is not present in the dataset.

Parameters: series the series (null not permitted).

Returns: The series index.

Since: 1.0.6

isAutoWidth

public boolean isAutoWidth()
Returns whether the interval width is automatically calculated or not.

Returns: Whether the width is automatically calculated or not.

removeAllSeries

public void removeAllSeries()
Removes all the series from the collection and sends a DatasetChangeEvent to all registered listeners.

removeSeries

public void removeSeries(int series)
Removes a series from the collection and sends a DatasetChangeEvent to all registered listeners.

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

removeSeries

public void removeSeries(XYSeries series)
Removes a series from the collection and sends a DatasetChangeEvent to all registered listeners.

Parameters: series the series (null not permitted).

setAutoWidth

public void setAutoWidth(boolean b)
Sets the flag that indicates wether the interval width is automatically calculated or not.

Parameters: b a boolean.

setIntervalPositionFactor

public void setIntervalPositionFactor(double factor)
Sets the interval position factor. This controls where the x-value is in relation to the interval surrounding the x-value (0.0 means the x-value will be positioned at the start, 0.5 in the middle, and 1.0 at the end).

Parameters: factor the factor.

setIntervalWidth

public void setIntervalWidth(double width)
Sets the interval width and sends a DatasetChangeEvent to all registered listeners.

Parameters: width the width (negative values not permitted).