Module org.jfree.chart3d
Package org.jfree.chart3d.data.xyz

# Class XYZSeriesCollection<S extends Comparable<S>>

java.lang.Object
org.jfree.chart3d.data.AbstractDataset3D
org.jfree.chart3d.data.xyz.XYZSeriesCollection<S>

All Implemented Interfaces:
  `Serializable`, `EventListener`, `Dataset3D`, `Series3DChangeListener`, `XYZDataset<S>`

public class XYZSeriesCollection<S extends Comparable<S>> extends AbstractDataset3D implements XYZDataset<S>, Series3DChangeListener, Serializable
A collection of `XYZSeries` objects (implements the `XYZDataset` interface so that it can be used as a source of data for an `XYZRenderer` on an `XYZPlot`).
NOTE: This class is serializable, but the serialization format is subject to change in future releases and should not be relied upon for persisting instances of this class.

See Also:
  - Serialized Form

## Constructor Summary

Constructors
Constructor
Description
`XYZSeriesCollection()`
Creates a new (empty) `XYZSeriesCollection` instance.

## Method Summary

Modifier and Type
Method
Description
`void`
`add(XYZSeries<S> series)`
Adds a series to the collection (note that the series key must be unique within the collection).
`boolean`
`equals(Object obj)`
Tests this dataset for equality with an arbitrary object.
`int`
`getItemCount(int seriesIndex)`
Returns the number of items in the specified series.
`XYZSeries<S>`
`getSeries(int index)`
Returns the series with the specified index.
`XYZSeries`
`getSeries(Comparable<?> key)`
Returns the series with the specified key, or `null` if there is no such series.
`int`
`getSeriesCount()`
Returns the number of series in the collection.
`int`
`getSeriesIndex(S key)`
Returns the index of the series with the specified key, or `-1` if there is no series with the specified key.
`S`
`getSeriesKey(int seriesIndex)`
Returns the key for the specified series.
`List<S>`
`getSeriesKeys()`
Returns a new list containing all the series keys.
`double`
`getX(int seriesIndex, int itemIndex)`
Returns the x-value for one item in a series.
`double`
`getY(int seriesIndex, int itemIndex)`
Returns the y-value for one item in a series.
`double`
`getZ(int seriesIndex, int itemIndex)`
Returns the z-value for one item in a series.
`int`
`hashCode()`
`void`
`remove(int seriesIndex)`
Removes a series from the collection and sends a `Dataset3DChangeEvent` to all registered listeners.
`void`
`remove(XYZSeries series)`
Removes a series from the collection and sends a `Dataset3DChangeEvent` to all registered listeners.
`void`
`removeAll()`
Removes all the series from the collection and sends a `Dataset3DChangeEvent` to all registered listeners.
`void`
`seriesChanged(Series3DChangeEvent event)`
Called when an observed series changes in some way.
`String`
`toString()`
Returns a string representation of this instance, primarily for debugging purposes.

### Methods inherited from class org.jfree.chart3d.data.AbstractDataset3D

`addChangeListener, fireChangeEvent, fireDatasetChanged, hasListener, isNotify, notifyListeners, removeChangeListener, setNotify`

### Methods inherited from class java.lang.Object

`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

### Methods inherited from interface org.jfree.chart3d.data.Dataset3D

`addChangeListener, hasListener, removeChangeListener`

## Constructor Details

### XYZSeriesCollection

public XYZSeriesCollection()
Creates a new (empty) `XYZSeriesCollection` instance.

## Method Details

### getSeriesCount

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

Specified by:
  `getSeriesCount` in interface `XYZDataset<S extends Comparable<S>>`
Returns:
  The number of series in the collection.

### getSeriesIndex

public int getSeriesIndex(S key)
Returns the index of the series with the specified key, or `-1` if there is no series with the specified key.

Specified by:
  `getSeriesIndex` in interface `XYZDataset<S extends Comparable<S>>`
Parameters:
  `key` - the key (`null` not permitted).
Returns:
  The series index or `-1`.

### getSeriesKeys

public List<S> getSeriesKeys()
Returns a new list containing all the series keys. Modifying this list will have no impact on the `XYZSeriesCollection` instance.

Specified by:
  `getSeriesKeys` in interface `XYZDataset<S extends Comparable<S>>`
Returns:
  A list containing the series keys (possibly empty, but never `null`).

### getSeriesKey

public S getSeriesKey(int seriesIndex)
Returns the key for the specified series.

Specified by:
  `getSeriesKey` in interface `XYZDataset<S extends Comparable<S>>`
Parameters:
  `seriesIndex` - the series index.
Returns:
  The series key.
Since:
  1.3

### add

public void add(XYZSeries<S> series)
Adds a series to the collection (note that the series key must be unique within the collection). The collection will automatically register to receive change events from the series, and fire a `Dataset3DChangeEvent` whenever the data in the series changes.

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

### remove

public void remove(int seriesIndex)
Removes a series from the collection and sends a `Dataset3DChangeEvent` to all registered listeners.

Parameters:
  `seriesIndex` - the series index.
Since:
  1.6

### remove

public void remove(XYZSeries series)
Removes a series from the collection and sends a `Dataset3DChangeEvent` to all registered listeners. If the series is not part of the collection, this method does nothing.

Parameters:
  `series` - the series (`null` not permitted).
Since:
  1.6

### removeAll

public void removeAll()
Removes all the series from the collection and sends a `Dataset3DChangeEvent` to all registered listeners. If the collection is already empty, this method does nothing.

### getSeries

public XYZSeries<S> getSeries(int index)
Returns the series with the specified index.

Parameters:
  `index` - the series index.
Returns:
  The series.
Since:
  1.2

### getSeries

public XYZSeries getSeries(Comparable<?> key)
Returns the series with the specified key, or `null` if there is no such series.

Parameters:
  `key` - the key (`null` not permitted).
Returns:
  The series.
Since:
  1.2

### getItemCount

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

Specified by:
  `getItemCount` in interface `XYZDataset<S extends Comparable<S>>`
Parameters:
  `seriesIndex` - the series index.
Returns:
  The number of items in the specified series.

### getX

public double getX(int seriesIndex, int itemIndex)
Returns the x-value for one item in a series.

Specified by:
  `getX` in interface `XYZDataset<S extends Comparable<S>>`
Parameters:
  `seriesIndex` - the series index.
  `itemIndex` - the item index.
Returns:
  The x-value.

### getY

public double getY(int seriesIndex, int itemIndex)
Returns the y-value for one item in a series.

Specified by:
  `getY` in interface `XYZDataset<S extends Comparable<S>>`
Parameters:
  `seriesIndex` - the series index.
  `itemIndex` - the item index.
Returns:
  The y-value.

### getZ

public double getZ(int seriesIndex, int itemIndex)
Returns the z-value for one item in a series.

Specified by:
  `getZ` in interface `XYZDataset<S extends Comparable<S>>`
Parameters:
  `seriesIndex` - the series index.
  `itemIndex` - the item index.
Returns:
  The z-value.

### seriesChanged

public void seriesChanged(Series3DChangeEvent event)
Called when an observed series changes in some way.

Specified by:
  `seriesChanged` in interface `Series3DChangeListener`
Parameters:
  `event` - information about the change.
Since:
  1.6

### equals

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

Overrides:
  `equals` in class `Object`
Parameters:
  `obj` - the object (`null` not permitted).
Returns:
  A boolean.

### hashCode

public int hashCode()

Overrides:
  `hashCode` in class `Object`

### toString

public String toString()
Returns a string representation of this instance, primarily for debugging purposes.
Implementation note: the current implementation (which is subject to change) writes the dataset in JSON format using `JSONUtils.writeXYZDataset(org.jfree.chart3d.data.xyz.XYZDataset)`.

Overrides:
  `toString` in class `Object`
Returns:
  A string.