org.jfree.data
Class SubSeriesDataset

java.lang.Object
  extended byorg.jfree.data.AbstractDataset
      extended byorg.jfree.data.AbstractSeriesDataset
          extended byorg.jfree.data.AbstractXYDataset
              extended byorg.jfree.data.AbstractIntervalXYDataset
                  extended byorg.jfree.data.SubSeriesDataset
All Implemented Interfaces:
java.lang.Cloneable, CombinationDataset, Dataset, java.util.EventListener, HighLowDataset, IntervalXYDataset, java.io.ObjectInputValidation, java.io.Serializable, SeriesChangeListener, SeriesDataset, SignalsDataset, XYDataset

public class SubSeriesDataset
extends AbstractIntervalXYDataset
implements HighLowDataset, SignalsDataset, IntervalXYDataset, CombinationDataset

This class will create a dataset with one or more series from another SeriesDataset.

Author:
Bill Kelemen (bill@kelemen-usa.com)
See Also:
Serialized Form

Field Summary
 
Fields inherited from interface org.jfree.data.SignalsDataset
ENTER_LONG, ENTER_SHORT, EXIT_LONG, EXIT_SHORT
 
Constructor Summary
SubSeriesDataset(SeriesDataset parent, int series)
          Creates a SubSeriesDataset using one series from parent.
SubSeriesDataset(SeriesDataset parent, int[] map)
          Creates a SubSeriesDataset using one or more series from parent.
 
Method Summary
 double getClose(int series, int item)
          Returns the close-value (as a double primitive) for an item within a series.
 java.lang.Number getCloseValue(int series, int item)
          Returns the close-value for the specified series and item.
 java.lang.Number getEndXValue(int series, int item)
          Returns the ending X value for the specified series and item.
 java.lang.Number getEndYValue(int series, int item)
          Returns the ending Y value for the specified series and item.
 double getHigh(int series, int item)
          Returns the high-value (as a double primitive) for an item within a series.
 java.lang.Number getHighValue(int series, int item)
          Returns the high-value for the specified series and item.
 int getItemCount(int series)
          Returns the number of items in a series.
 double getLevel(int series, int item)
          Returns the level.
 double getLow(int series, int item)
          Returns the low-value (as a double primitive) for an item within a series.
 java.lang.Number getLowValue(int series, int item)
          Returns the low-value for the specified series and item.
 int[] getMap()
          Returns a map or indirect indexing form our series into parent's series.
 double getOpen(int series, int item)
          Returns the open-value (as a double primitive) for an item within a series.
 java.lang.Number getOpenValue(int series, int item)
          Returns the open-value for the specified series and item.
 SeriesDataset getParent()
          Returns the parent Dataset of this combination.
 int getSeriesCount()
          Returns the number of series in the dataset.
 java.lang.String getSeriesName(int series)
          Returns the name of a series.
 java.lang.Number getStartXValue(int series, int item)
          Returns the starting X value for the specified series and item.
 java.lang.Number getStartYValue(int series, int item)
          Returns the starting Y value for the specified series and item.
 int getType(int series, int item)
          Returns the type.
 double getVolume(int series, int item)
          Returns the volume-value (as a double primitive) for an item within a series.
 java.lang.Number getVolumeValue(int series, int item)
          Returns the volume.
 java.lang.Number getXValue(int series, int item)
          Returns the X-value for the specified series and item.
 java.lang.Number getYValue(int series, int item)
          Returns the Y-value for the specified series and item.
 
Methods inherited from class org.jfree.data.AbstractIntervalXYDataset
getEndX, getEndY, getStartX, getStartY
 
Methods inherited from class org.jfree.data.AbstractXYDataset
getX, getY
 
Methods inherited from class org.jfree.data.AbstractSeriesDataset
seriesChanged
 
Methods inherited from class org.jfree.data.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.XYDataset
getX, getY
 
Methods inherited from interface org.jfree.data.Dataset
addChangeListener, getGroup, removeChangeListener, setGroup
 
Methods inherited from interface org.jfree.data.IntervalXYDataset
getEndX, getEndY, getStartX, getStartY
 

Constructor Detail

SubSeriesDataset

public SubSeriesDataset(SeriesDataset parent,
                        int[] map)
Creates a SubSeriesDataset using one or more series from parent. The series to use are passed as an array of int.

Parameters:
parent - underlying dataset
map - int[] of series from parent to include in this Dataset

SubSeriesDataset

public SubSeriesDataset(SeriesDataset parent,
                        int series)
Creates a SubSeriesDataset using one series from parent. The series to is passed as an int.

Parameters:
parent - underlying dataset
series - series from parent to include in this Dataset
Method Detail

getHighValue

public java.lang.Number getHighValue(int series,
                                     int item)
Returns the high-value for the specified series and item.

Note: throws ClassCastException if the series if not from a HighLowDataset.

Specified by:
getHighValue in interface HighLowDataset
Parameters:
series - the index of the series of interest (zero-based).
item - the index of the item of interest (zero-based).
Returns:
the high-value for the specified series and item.

getHigh

public double getHigh(int series,
                      int item)
Returns the high-value (as a double primitive) for an item within a series.

Specified by:
getHigh in interface HighLowDataset
Parameters:
series - the series (zero-based index).
item - the item (zero-based index).
Returns:
The high-value.

getLowValue

public java.lang.Number getLowValue(int series,
                                    int item)
Returns the low-value for the specified series and item.

Note: throws ClassCastException if the series if not from a HighLowDataset.

Specified by:
getLowValue in interface HighLowDataset
Parameters:
series - the index of the series of interest (zero-based).
item - the index of the item of interest (zero-based).
Returns:
the low-value for the specified series and item.

getLow

public double getLow(int series,
                     int item)
Returns the low-value (as a double primitive) for an item within a series.

Specified by:
getLow in interface HighLowDataset
Parameters:
series - the series (zero-based index).
item - the item (zero-based index).
Returns:
The low-value.

getOpenValue

public java.lang.Number getOpenValue(int series,
                                     int item)
Returns the open-value for the specified series and item.

Note: throws ClassCastException if the series if not from a HighLowDataset.

Specified by:
getOpenValue in interface HighLowDataset
Parameters:
series - the index of the series of interest (zero-based).
item - the index of the item of interest (zero-based).
Returns:
the open-value for the specified series and item.

getOpen

public double getOpen(int series,
                      int item)
Returns the open-value (as a double primitive) for an item within a series.

Specified by:
getOpen in interface HighLowDataset
Parameters:
series - the series (zero-based index).
item - the item (zero-based index).
Returns:
The open-value.

getCloseValue

public java.lang.Number getCloseValue(int series,
                                      int item)
Returns the close-value for the specified series and item.

Note: throws ClassCastException if the series if not from a HighLowDataset.

Specified by:
getCloseValue in interface HighLowDataset
Parameters:
series - the index of the series of interest (zero-based).
item - the index of the item of interest (zero-based).
Returns:
the close-value for the specified series and item.

getClose

public double getClose(int series,
                       int item)
Returns the close-value (as a double primitive) for an item within a series.

Specified by:
getClose in interface HighLowDataset
Parameters:
series - the series (zero-based index).
item - the item (zero-based index).
Returns:
The close-value.

getVolumeValue

public java.lang.Number getVolumeValue(int series,
                                       int item)
Returns the volume.

Note: throws ClassCastException if the series if not from a HighLowDataset.

Specified by:
getVolumeValue in interface HighLowDataset
Parameters:
series - the series (zero based index).
item - the item (zero based index).
Returns:
the volume.

getVolume

public double getVolume(int series,
                        int item)
Returns the volume-value (as a double primitive) for an item within a series.

Specified by:
getVolume in interface HighLowDataset
Parameters:
series - the series (zero-based index).
item - the item (zero-based index).
Returns:
The volume-value.

getXValue

public java.lang.Number getXValue(int series,
                                  int item)
Returns the X-value for the specified series and item.

Note: throws ClassCastException if the series if not from a XYDataset.

Specified by:
getXValue in interface XYDataset
Parameters:
series - the index of the series of interest (zero-based);
item - the index of the item of interest (zero-based).
Returns:
the X-value for the specified series and item.

getYValue

public java.lang.Number getYValue(int series,
                                  int item)
Returns the Y-value for the specified series and item.

Note: throws ClassCastException if the series if not from a XYDataset.

Specified by:
getYValue in interface XYDataset
Parameters:
series - the index of the series of interest (zero-based).
item - the index of the item of interest (zero-based).
Returns:
the Y-value for the specified series and item.

getItemCount

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

Note: throws ClassCastException if the series if not from a XYDataset.

Specified by:
getItemCount in interface XYDataset
Parameters:
series - the index of the series of interest (zero-based).
Returns:
the number of items in a series.

getSeriesCount

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

Specified by:
getSeriesCount in interface SeriesDataset
Specified by:
getSeriesCount in class AbstractSeriesDataset
Returns:
the number of series in the dataset.

getSeriesName

public java.lang.String getSeriesName(int series)
Returns the name of a series.

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

getStartXValue

public java.lang.Number getStartXValue(int series,
                                       int item)
Returns the starting X value for the specified series and item.

Specified by:
getStartXValue in interface IntervalXYDataset
Parameters:
series - the index of the series of interest (zero-based).
item - the index of the item of interest (zero-based).
Returns:
the starting X value for the specified series and item.

getEndXValue

public java.lang.Number getEndXValue(int series,
                                     int item)
Returns the ending X value for the specified series and item.

Specified by:
getEndXValue in interface IntervalXYDataset
Parameters:
series - the index of the series of interest (zero-based).
item - the index of the item of interest (zero-based).
Returns:
the ending X value for the specified series and item.

getStartYValue

public java.lang.Number getStartYValue(int series,
                                       int item)
Returns the starting Y value for the specified series and item.

Specified by:
getStartYValue in interface IntervalXYDataset
Parameters:
series - the index of the series of interest (zero-based).
item - the index of the item of interest (zero-based).
Returns:
the starting Y value for the specified series and item.

getEndYValue

public java.lang.Number getEndYValue(int series,
                                     int item)
Returns the ending Y value for the specified series and item.

Specified by:
getEndYValue in interface IntervalXYDataset
Parameters:
series - the index of the series of interest (zero-based).
item - the index of the item of interest (zero-based).
Returns:
the ending Y value for the specified series and item.

getType

public int getType(int series,
                   int item)
Returns the type.

Specified by:
getType in interface SignalsDataset
Parameters:
series - the series (zero based index).
item - the item (zero based index).
Returns:
the type.

getLevel

public double getLevel(int series,
                       int item)
Returns the level.

Specified by:
getLevel in interface SignalsDataset
Parameters:
series - the series (zero based index).
item - the item (zero based index).
Returns:
the level.

getParent

public SeriesDataset getParent()
Returns the parent Dataset of this combination.

Specified by:
getParent in interface CombinationDataset
Returns:
the parent Dataset of this combination.

getMap

public int[] getMap()
Returns a map or indirect indexing form our series into parent's series.

Specified by:
getMap in interface CombinationDataset
Returns:
a map or indirect indexing form our series into parent's series.