## org.jfree.data.time
Class TimeSeriesCollection

    java.lang.Object
      org.jfree.data.general.AbstractDataset
          org.jfree.data.general.AbstractSeriesDataset
              org.jfree.data.xy.AbstractXYDataset
                  org.jfree.data.xy.AbstractIntervalXYDataset
                      org.jfree.data.time.TimeSeriesCollection

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

    public class TimeSeriesCollection

extends AbstractIntervalXYDataset
implements XYDataset, IntervalXYDataset, DomainInfo, java.io.Serializable

A collection of time series objects.

This class implements the `XYDataset` interface, as well as the extended `IntervalXYDataset` interface. This makes it a convenient dataset for use with the `XYPlot` class.

See Also:
  Serialized Form

Constructor Summary
`TimeSeriesCollection()` Constructs an empty dataset, tied to the default timezone.
`TimeSeriesCollection(TimeSeries series)` Constructs a dataset containing a single series (more can be added), tied to the default timezone.
`TimeSeriesCollection(TimeSeries series, java.util.TimeZone zone)` Constructs a dataset containing a single series (more can be added), tied to a specific timezone.
`TimeSeriesCollection(java.util.TimeZone zone)` Constructs an empty dataset, tied to a specific timezone.

Method Summary
`void` `addSeries(TimeSeries series)` Adds a series to the collection and sends a `DatasetChangeEvent` to all registered listeners.
`boolean` `equals(java.lang.Object obj)` Tests this time series collection for equality with another object.
`Range` `getDomainBounds(boolean includeInterval)` Returns the range of the values in this dataset's domain.
`boolean` `getDomainIsPointsInTime()` Returns a flag that controls whether the domain is treated as 'points in time'.
`double` `getDomainLowerBound(boolean includeInterval)` Returns the minimum x-value in the dataset.
`double` `getDomainUpperBound(boolean includeInterval)` Returns the maximum x-value in the dataset.
`java.lang.Number` `getEndX(int series, int item)` Returns the ending X value for the specified series and item.
`java.lang.Number` `getEndY(int series, int item)` Returns the ending Y value for the specified series and item.
`int` `getItemCount(int series)` Returns the number of items in the specified series.
`java.util.List` `getSeries()` Returns a list of all the series in the collection.
`TimeSeries` `getSeries(int series)` Returns a series.
`TimeSeries` `getSeries(java.lang.String name)` Returns the series with the specified name, or `null` if there is no such 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` `getStartX(int series, int item)` Returns the starting X value for the specified series and item.
`java.lang.Number` `getStartY(int series, int item)` Returns the starting Y value for the specified series and item.
`int[]` `getSurroundingItems(int series, long milliseconds)` Returns the indices of the two data items surrounding a particular millisecond value.
`java.lang.Number` `getX(int series, int item)` Returns the x-value for the specified series and item.
`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 (as a double primitive) for an item within a series.
`java.lang.Number` `getY(int series, int item)` Returns the y-value for the specified series and item.
`int` `hashCode()` Returns a hash code value for the object.
`void` `removeAllSeries()` Removes all the series from the collection and sends a `DatasetChangeEvent` to all registered listeners.
`void` `removeSeries(int index)` Removes a series from the collection.
`void` `removeSeries(TimeSeries series)` Removes the specified series from the collection and sends a `DatasetChangeEvent` to all registered listeners.
`void` `setDomainIsPointsInTime(boolean flag)` Sets a flag that controls whether the domain is treated as 'points in time', or time periods.
`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.AbstractIntervalXYDataset
`getEndXValue, getEndYValue, getStartXValue, getStartYValue`

Methods inherited from class org.jfree.data.xy.AbstractXYDataset
`getDomainOrder, getYValue`

Methods inherited from class org.jfree.data.general.AbstractSeriesDataset
`seriesChanged`

Methods inherited from class org.jfree.data.general.AbstractDataset
`addChangeListener, clone, fireDatasetChanged, getGroup, 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.IntervalXYDataset
`getEndXValue, getEndYValue, getStartXValue, getStartYValue`

Constructor Detail

### TimeSeriesCollection

    public TimeSeriesCollection()

  Constructs an empty dataset, tied to the default timezone.

### TimeSeriesCollection

    public TimeSeriesCollection(java.util.TimeZone zone)

  Constructs an empty dataset, tied to a specific timezone.

  Parameters:
    `zone` - the timezone (`null` permitted, will use `TimeZone.getDefault()` in that case).

### TimeSeriesCollection

    public TimeSeriesCollection(TimeSeries series)

  Constructs a dataset containing a single series (more can be added), tied to the default timezone.

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

### TimeSeriesCollection

    public TimeSeriesCollection(TimeSeries series,
                                java.util.TimeZone zone)

  Constructs a dataset containing a single series (more can be added), tied to a specific timezone.

  Parameters:
    `series` - a series to add to the collection (`null` permitted).
    `zone` - the timezone (`null` permitted, will use `TimeZone.getDefault()` in that case).

Method Detail

### getDomainIsPointsInTime

    public boolean getDomainIsPointsInTime()

  Returns a flag that controls whether the domain is treated as 'points in time'.

  This flag is used when determining the max and min values for the domain. If true, then only the x-values are considered for the max and min values. If false, then the start and end x-values will also be taken into consideration

  Returns:
    The flag.

### setDomainIsPointsInTime

    public void setDomainIsPointsInTime(boolean flag)

  Sets a flag that controls whether the domain is treated as 'points in time', or time periods.

  Parameters:
    `flag` - the flag.

### 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`).

### 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).

### getSeries

    public java.util.List getSeries()

  Returns a list of all the series in the collection.

  Returns:
    The list (which is unmodifiable).

### 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 TimeSeries getSeries(int series)

  Returns a series.

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

### getSeries

    public TimeSeries getSeries(java.lang.String name)

  Returns the series with the specified name, or `null` if there is no such series.

  Parameters:
    `name` - the series name (`null` permitted).
  Returns:
    The series with the given name.

### getSeriesName

    public java.lang.String getSeriesName(int series)

  Returns the name of a series. This method is provided for convenience.

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

### addSeries

    public void addSeries(TimeSeries series)

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

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

### removeSeries

    public void removeSeries(TimeSeries series)

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

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

### removeSeries

    public void removeSeries(int index)

  Removes a series from the collection.

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

### removeAllSeries

    public void removeAllSeries()

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

### getItemCount

    public int getItemCount(int series)

  Returns the number of items in the specified series. This method is provided for convenience.

  Specified by:
    `getItemCount` in interface `XYDataset`
  Parameters:
    `series` - the series index (zero-based).
  Returns:
    The item count.

### getXValue

    public double getXValue(int series,
                            int item)

  Returns the x-value (as a double primitive) for an item within a series.

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

### getX

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

  Returns the x-value for the specified series and item.

  Specified by:
    `getX` in interface `XYDataset`
  Parameters:
    `series` - the series (zero-based index).
    `item` - the item (zero-based index).
  Returns:
    The value.

### getX

    protected long getX(RegularTimePeriod period)

  Returns the x-value for a time period.

  Parameters:
    `period` - the time period.
  Returns:
    The x-value.

### getStartX

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

  Returns the starting X value for the specified series and item.

  Specified by:
    `getStartX` in interface `IntervalXYDataset`
  Parameters:
    `series` - the series (zero-based index).
    `item` - the item (zero-based index).
  Returns:
    The value.

### getEndX

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

  Returns the ending X value for the specified series and item.

  Specified by:
    `getEndX` in interface `IntervalXYDataset`
  Parameters:
    `series` - The series (zero-based index).
    `item` - The item (zero-based index).
  Returns:
    The value.

### getY

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

  Returns the y-value for the specified series and item.

  Specified by:
    `getY` in interface `XYDataset`
  Parameters:
    `series` - the series (zero-based index).
    `item` - the item (zero-based index).
  Returns:
    The value (possibly `null`).

### getStartY

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

  Returns the starting Y value for the specified series and item.

  Specified by:
    `getStartY` in interface `IntervalXYDataset`
  Parameters:
    `series` - the series (zero-based index).
    `item` - the item (zero-based index).
  Returns:
    The value (possibly `null`).

### getEndY

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

  Returns the ending Y value for the specified series and item.

  Specified by:
    `getEndY` in interface `IntervalXYDataset`
  Parameters:
    `series` - te series (zero-based index).
    `item` - the item (zero-based index).
  Returns:
    The value (possibly `null`).

### getSurroundingItems

    public int[] getSurroundingItems(int series,
                                     long milliseconds)

  Returns the indices of the two data items surrounding a particular millisecond value.

  Parameters:
    `series` - the series index.
    `milliseconds` - the time.
  Returns:
    An array containing the (two) indices of the items surrounding the time.

### getDomainLowerBound

    public double getDomainLowerBound(boolean includeInterval)

  Returns the minimum x-value in the dataset.

  Specified by:
    `getDomainLowerBound` in interface `DomainInfo`
  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.

  Specified by:
    `getDomainUpperBound` in interface `DomainInfo`
  Parameters:
    `includeInterval` - a flag that determines whether or not the x-interval is taken into account.
  Returns:
    The maximum value.

### getDomainBounds

    public Range getDomainBounds(boolean includeInterval)

  Returns the range of the values in this dataset's domain.

  Specified by:
    `getDomainBounds` in interface `DomainInfo`
  Parameters:
    `includeInterval` - a flag that determines whether or not the x-interval is taken into account.
  Returns:
    The range.

### equals

    public boolean equals(java.lang.Object obj)

  Tests this time series collection for equality with another object.

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

### hashCode

    public int hashCode()

  Returns a hash code value for the object.

  Overrides:
    `hashCode` in class `java.lang.Object`
  Returns:
    the hashcode