com.orsoncharts.data.xyz

## Class XYZSeriesCollection<S extends java.lang.Comparable<S>>

- java.lang.Object
- - com.orsoncharts.data.AbstractDataset3D
  - - com.orsoncharts.data.xyz.XYZSeriesCollection<S>

- All Implemented Interfaces:
    Dataset3D, Series3DChangeListener, XYZDataset<S>, java.io.Serializable, java.util.EventListener

      public class XYZSeriesCollection<S extends java.lang.Comparable<S>>
      extends AbstractDataset3D
      implements XYZDataset<S>, Series3DChangeListener, java.io.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 and Description
    `XYZSeriesCollection()` Creates a new (empty) `XYZSeriesCollection` instance.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and 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(java.lang.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` | `getSeries(java.lang.Comparable<?> key)` Returns the series with the specified key, or `null` if there is no such series.
    `XYZSeries<S>` | `getSeries(int index)` Returns the series with the specified index.
    `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.
    `java.util.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.
    `java.lang.String` | `toString()` Returns a string representation of this instance, primarily for debugging purposes.

    - ### Methods inherited from class com.orsoncharts.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 com.orsoncharts.data.Dataset3D

      `addChangeListener, hasListener, removeChangeListener`

- - ### Constructor Detail

    - #### XYZSeriesCollection

          public XYZSeriesCollection()

      Creates a new (empty) `XYZSeriesCollection` instance.

  - ### Method Detail

    - #### getSeriesCount

          public int getSeriesCount()

      Returns the number of series in the collection.
      Specified by:
        `getSeriesCount` in interface `XYZDataset<S extends java.lang.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 java.lang.Comparable<S>>`
      Parameters:
        `key` - the key (`null` not permitted).
      Returns:
        The series index or `-1`.

    - #### getSeriesKeys

          public java.util.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 java.lang.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 java.lang.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(java.lang.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 java.lang.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 java.lang.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 java.lang.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 java.lang.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(java.lang.Object obj)

      Tests this dataset for equality with an arbitrary object.
      Overrides:
        `equals` in class `java.lang.Object`
      Parameters:
        `obj` - the object (`null` not permitted).
      Returns:
        A boolean.

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `java.lang.Object`

    - #### toString

          public java.lang.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(com.orsoncharts.data.xyz.XYZDataset)`.
      Overrides:
        `toString` in class `java.lang.Object`
      Returns:
        A string.