org.jfree.data.time
Class TimePeriodValuesCollection

java.lang.Object
  extended byorg.jfree.data.general.AbstractDataset
      extended byorg.jfree.data.general.AbstractSeriesDataset
          extended byorg.jfree.data.xy.AbstractXYDataset
              extended byorg.jfree.data.xy.AbstractIntervalXYDataset
                  extended byorg.jfree.data.time.TimePeriodValuesCollection
All Implemented Interfaces:
java.lang.Cloneable, Dataset, DomainInfo, java.util.EventListener, IntervalXYDataset, java.io.ObjectInputValidation, java.io.Serializable, SeriesChangeListener, SeriesDataset, XYDataset

public class TimePeriodValuesCollection
extends AbstractIntervalXYDataset
implements IntervalXYDataset, DomainInfo, java.io.Serializable

A collection of TimePeriodValues 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
TimePeriodValuesCollection()
          Constructs an empty dataset.
TimePeriodValuesCollection(TimePeriodValues series)
          Constructs a dataset containing a single series.
 
Method Summary
 void addSeries(TimePeriodValues series)
          Adds a series to the collection.
 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.
 TimePeriodValues getSeries(int series)
          Returns a 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.
 java.lang.Number getX(int series, int item)
          Returns the x-value for the specified series and item.
 TimePeriodAnchor getXPosition()
          Returns the position of the X value within each time period.
 java.lang.Number getY(int series, int item)
          Returns the y-value for the specified series and item.
 void removeSeries(int index)
          Removes a series from the collection.
 void removeSeries(TimePeriodValues series)
          Removes the specified series from the collection.
 void setDomainIsPointsInTime(boolean flag)
          Sets a flag that controls whether the domain is treated as 'points in time', or time periods.
 void setXPosition(TimePeriodAnchor position)
          Sets the position of the x axis within each time period.
 
Methods inherited from class org.jfree.data.xy.AbstractIntervalXYDataset
getEndXValue, getEndYValue, getStartXValue, getStartYValue
 
Methods inherited from class org.jfree.data.xy.AbstractXYDataset
getDomainOrder, getXValue, 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
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jfree.data.xy.IntervalXYDataset
getEndXValue, getEndYValue, getStartXValue, getStartYValue
 
Methods inherited from interface org.jfree.data.xy.XYDataset
getDomainOrder, getXValue, getYValue
 
Methods inherited from interface org.jfree.data.general.Dataset
addChangeListener, getGroup, removeChangeListener, setGroup
 

Constructor Detail

TimePeriodValuesCollection

public TimePeriodValuesCollection()
Constructs an empty dataset.


TimePeriodValuesCollection

public TimePeriodValuesCollection(TimePeriodValues series)
Constructs a dataset containing a single series. Additional series can be added.

Parameters:
series - the series.
Method Detail

getXPosition

public TimePeriodAnchor getXPosition()
Returns the position of the X value within each time period.

Returns:
The position (never null).

setXPosition

public void setXPosition(TimePeriodAnchor position)
Sets the position of the x axis within each time period.

Parameters:
position - the position (null not permitted).

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 new value of the flag.

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 TimePeriodValues getSeries(int series)
Returns a series.

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

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(TimePeriodValues series)
Adds a series to the collection. A DatasetChangeEvent is sent to all registered listeners.

Parameters:
series - the time series.

removeSeries

public void removeSeries(TimePeriodValues series)
Removes the specified series from the collection.

Parameters:
series - the series to remove.

removeSeries

public void removeSeries(int index)
Removes a series from the collection.

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

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 index of the series of interest (zero-based).
Returns:
The number of items in the specified series.

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 x-value for the specified series and item.

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 starting X value for the specified series and item.

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 ending X value for the specified series and item.

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 y-value for the specified series and item.

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 starting Y value for the specified series and item.

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 - the series (zero-based index).
item - the item (zero-based index).
Returns:
The ending Y value for the specified series and item.

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.