org.jfree.data.time.ohlc

## Class OHLCSeriesCollection

- java.lang.Object
- - org.jfree.data.general.AbstractDataset
  - - org.jfree.data.general.AbstractSeriesDataset
    - - org.jfree.data.xy.AbstractXYDataset
      - - org.jfree.data.time.ohlc.OHLCSeriesCollection

All Implemented Interfaces:
  java.io.ObjectInputValidation, java.io.Serializable, java.lang.Cloneable, java.util.EventListener, Dataset, SeriesChangeListener, SeriesDataset, OHLCDataset, XYDataset

    public class OHLCSeriesCollection
    extends AbstractXYDataset
    implements OHLCDataset, java.io.Serializable

A collection of `OHLCSeries` objects.

Since:
  1.0.4
See Also:
  `OHLCSeries`, Serialized Form

### Constructor Summary

Constructors
Constructor and Description
`OHLCSeriesCollection()` Creates a new instance of `OHLCSeriesCollection`.

### Method Summary

Methods
`void` `addSeries(OHLCSeries series)` Adds a series to the collection and sends a `DatasetChangeEvent` to all registered listeners.
`java.lang.Object` `clone()` Returns a clone of this instance.
`boolean` `equals(java.lang.Object obj)` Tests this instance for equality with an arbitrary object.
`java.lang.Number` `getClose(int series, int item)` Returns the close-value for an item within a series.
`double` `getCloseValue(int series, int item)` Returns the close-value for an item within a series.
`java.lang.Number` `getHigh(int series, int item)` Returns the high-value for an item within a series.
`double` `getHighValue(int series, int item)` Returns the high-value for an item within a series.
`int` `getItemCount(int series)` Returns the number of items in the specified series.
`java.lang.Number` `getLow(int series, int item)` Returns the low-value for an item within a series.
`double` `getLowValue(int series, int item)` Returns the low-value for an item within a series.
`java.lang.Number` `getOpen(int series, int item)` Returns the open-value for an item within a series.
`double` `getOpenValue(int series, int item)` Returns the open-value for an item within a series.
`OHLCSeries` `getSeries(int series)` Returns a series from the collection.
`int` `getSeriesCount()` Returns the number of series in the collection.
`java.lang.Comparable` `getSeriesKey(int series)` Returns the key for a series.
`java.lang.Number` `getVolume(int series, int item)` Returns `null` always, because this dataset doesn't record any volume data.
`double` `getVolumeValue(int series, int item)` Returns `Double.NaN` always, because this dataset doesn't record any volume data.
`java.lang.Number` `getX(int series, int item)` Returns the x-value for an item within a series.
`protected long` `getX(RegularTimePeriod period)` Returns the x-value for a time period.
`TimePeriodAnchor` `getXPosition()` Returns the position within each time period that is used for the X value when the collection is used as an `XYDataset`.
`double` `getXValue(int series, int item)` Returns the x-value for an item within a series.
`java.lang.Number` `getY(int series, int item)` Returns the y-value for an item within a series.
`int` `hashCode()` Returns a hash code for this instance.
`void` `removeAllSeries()` Removes all the series from the collection and sends a `DatasetChangeEvent` to all registered listeners.
`void` `removeSeries(int index)` Removes the series with the specified index and sends a `DatasetChangeEvent` to all registered listeners.
`boolean` `removeSeries(OHLCSeries series)` Removes the specified series from the dataset and sends a `DatasetChangeEvent` to all registered listeners.
`void` `setXPosition(TimePeriodAnchor anchor)` Sets the position within each time period that is used for the X values when the collection is used as an `XYDataset`, then sends a `DatasetChangeEvent` is sent to all registered listeners.

### Methods inherited from class org.jfree.data.xy.AbstractXYDataset

`getDomainOrder, getYValue`

### Methods inherited from class org.jfree.data.general.AbstractSeriesDataset

`indexOf, seriesChanged`

### Methods inherited from class org.jfree.data.general.AbstractDataset

`addChangeListener, fireDatasetChanged, getGroup, hasListener, notifyListeners, removeChangeListener, setGroup, validateObject`

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

`finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface org.jfree.data.xy.XYDataset

`getDomainOrder, getYValue`

### Methods inherited from interface org.jfree.data.general.SeriesDataset

`indexOf`

### Methods inherited from interface org.jfree.data.general.Dataset

`addChangeListener, getGroup, removeChangeListener, setGroup`

### Constructor Detail

#### OHLCSeriesCollection

    public OHLCSeriesCollection()

Creates a new instance of `OHLCSeriesCollection`.

### Method Detail

#### getXPosition

    public TimePeriodAnchor getXPosition()

Returns the position within each time period that is used for the X value when the collection is used as an `XYDataset`.

Returns:
  The anchor position (never `null`).
Since:
  1.0.11

#### setXPosition

    public void setXPosition(TimePeriodAnchor anchor)

Sets the position within each time period that is used for the X values when the collection is used as an `XYDataset`, then sends a `DatasetChangeEvent` is sent to all registered listeners.

Parameters:
  `anchor` - the anchor position (`null` not permitted).
Since:
  1.0.11

#### addSeries

    public void addSeries(OHLCSeries series)

Adds a series to the collection and sends a `DatasetChangeEvent` to all registered listeners.

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

#### 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 series count.

#### getSeries

    public OHLCSeries getSeries(int series)

Returns a series from the collection.

Parameters:
  `series` - the series index (zero-based).
Returns:
  The series.
Throws:
  `java.lang.IllegalArgumentException` - if `series` is not in the range `0` to `getSeriesCount() - 1`.

#### getSeriesKey

    public java.lang.Comparable getSeriesKey(int series)

Returns the key for a series.

Specified by:
  `getSeriesKey` in interface `SeriesDataset`
Specified by:
  `getSeriesKey` in class `AbstractSeriesDataset`
Parameters:
  `series` - the series index (in the range `0` to `getSeriesCount() - 1`).
Returns:
  The key for a series.
Throws:
  `java.lang.IllegalArgumentException` - if `series` is not in the specified range.

#### 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 item count.
Throws:
  `java.lang.IllegalArgumentException` - if `series` is not in the range `0` to `getSeriesCount() - 1`.

#### getX

    protected long getX(RegularTimePeriod period)

Returns the x-value for a time period.

Parameters:
  `period` - the time period (`null` not permitted).
Returns:
  The x-value.

#### getXValue

    public double getXValue(int series,
                   int item)

Returns the x-value for an item within a series.

Specified by:
  `getXValue` in interface `XYDataset`
Overrides:
  `getXValue` in class `AbstractXYDataset`
Parameters:
  `series` - the series index.
  `item` - the item index.
Returns:
  The x-value.

#### getX

    public java.lang.Number getX(int series,
                        int item)

Returns the x-value for an item within a series.

Specified by:
  `getX` in interface `XYDataset`
Parameters:
  `series` - the series index.
  `item` - the item index.
Returns:
  The x-value.

#### getY

    public java.lang.Number getY(int series,
                        int item)

Returns the y-value for an item within a series.

Specified by:
  `getY` in interface `XYDataset`
Parameters:
  `series` - the series index.
  `item` - the item index.
Returns:
  The y-value.

#### getOpenValue

    public double getOpenValue(int series,
                      int item)

Returns the open-value for an item within a series.

Specified by:
  `getOpenValue` in interface `OHLCDataset`
Parameters:
  `series` - the series index.
  `item` - the item index.
Returns:
  The open-value.

#### getOpen

    public java.lang.Number getOpen(int series,
                           int item)

Returns the open-value for an item within a series.

Specified by:
  `getOpen` in interface `OHLCDataset`
Parameters:
  `series` - the series index.
  `item` - the item index.
Returns:
  The open-value.

#### getCloseValue

    public double getCloseValue(int series,
                       int item)

Returns the close-value for an item within a series.

Specified by:
  `getCloseValue` in interface `OHLCDataset`
Parameters:
  `series` - the series index.
  `item` - the item index.
Returns:
  The close-value.

#### getClose

    public java.lang.Number getClose(int series,
                            int item)

Returns the close-value for an item within a series.

Specified by:
  `getClose` in interface `OHLCDataset`
Parameters:
  `series` - the series index.
  `item` - the item index.
Returns:
  The close-value.

#### getHighValue

    public double getHighValue(int series,
                      int item)

Returns the high-value for an item within a series.

Specified by:
  `getHighValue` in interface `OHLCDataset`
Parameters:
  `series` - the series index.
  `item` - the item index.
Returns:
  The high-value.

#### getHigh

    public java.lang.Number getHigh(int series,
                           int item)

Returns the high-value for an item within a series.

Specified by:
  `getHigh` in interface `OHLCDataset`
Parameters:
  `series` - the series index.
  `item` - the item index.
Returns:
  The high-value.

#### getLowValue

    public double getLowValue(int series,
                     int item)

Returns the low-value for an item within a series.

Specified by:
  `getLowValue` in interface `OHLCDataset`
Parameters:
  `series` - the series index.
  `item` - the item index.
Returns:
  The low-value.

#### getLow

    public java.lang.Number getLow(int series,
                          int item)

Returns the low-value for an item within a series.

Specified by:
  `getLow` in interface `OHLCDataset`
Parameters:
  `series` - the series index.
  `item` - the item index.
Returns:
  The low-value.

#### getVolume

    public java.lang.Number getVolume(int series,
                             int item)

Returns `null` always, because this dataset doesn't record any volume data.

Specified by:
  `getVolume` in interface `OHLCDataset`
Parameters:
  `series` - the series index (ignored).
  `item` - the item index (ignored).
Returns:
  `null`.

#### getVolumeValue

    public double getVolumeValue(int series,
                        int item)

Returns `Double.NaN` always, because this dataset doesn't record any volume data.

Specified by:
  `getVolumeValue` in interface `OHLCDataset`
Parameters:
  `series` - the series index (ignored).
  `item` - the item index (ignored).
Returns:
  `Double.NaN`.

#### removeSeries

    public void removeSeries(int index)

Removes the series with the specified index and sends a `DatasetChangeEvent` to all registered listeners.

Parameters:
  `index` - the series index.
Since:
  1.0.14

#### removeSeries

    public boolean removeSeries(OHLCSeries series)

Removes the specified series from the dataset and sends a `DatasetChangeEvent` to all registered listeners.

Parameters:
  `series` - the series (`null` not permitted).
Returns:
  `true` if the series was removed, and `false` otherwise.
Since:
  1.0.14

#### removeAllSeries

    public void removeAllSeries()

Removes all the series from the collection and sends a `DatasetChangeEvent` to all registered listeners.

Since:
  1.0.14

#### equals

    public boolean equals(java.lang.Object obj)

Tests this instance for equality with an arbitrary object.

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

#### hashCode

    public int hashCode()

Returns a hash code for this instance.

Overrides:
  `hashCode` in class `java.lang.Object`
Returns:
  A hash code.

#### clone

    public java.lang.Object clone()
                           throws java.lang.CloneNotSupportedException

Returns a clone of this instance.

Overrides:
  `clone` in class `AbstractDataset`
Returns:
  A clone.
Throws:
  `java.lang.CloneNotSupportedException` - if there is a problem.