com.jrefinery.data
Class SubSeriesDataset

java.lang.Object
  extended by com.jrefinery.data.AbstractDataset
      extended by com.jrefinery.data.AbstractSeriesDataset
          extended by com.jrefinery.data.SubSeriesDataset
All Implemented Interfaces:
CombinationDataset, Dataset, HighLowDataset, IntervalXYDataset, SeriesChangeListener, SeriesDataset, SignalsDataset, XYDataset

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

This class will create a Dataset with one or more series from another SeriesDataset. This is required when using a CombinedPlot to assign a sub-dataset to internal plots and avoid displaying all series on all internal plots.

Author:
Bill Kelemen (bill@kelemen-usa.com)
See Also:
com.jrefinery.chart.CombinedPlot

Field Summary
 
Fields inherited from class com.jrefinery.data.AbstractDataset
listeners
 
Fields inherited from interface com.jrefinery.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
 void addXYData(int series, java.lang.Object xObject, java.lang.Object yObject, int n)
           
 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.
 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)
           
 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.
 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)
           
 java.lang.Number getVolumeValue(int series, int item)
          Returns the volume for the specified series and item.
 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 com.jrefinery.data.AbstractSeriesDataset
getLegendItemCount, getLegendItemLabels, seriesChanged
 
Methods inherited from class com.jrefinery.data.AbstractDataset
addChangeListener, fireDatasetChanged, notifyListeners, removeChangeListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.jrefinery.data.Dataset
addChangeListener, removeChangeListener
 

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.

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).
Throws:
java.lang.ClassCastException - if the series if not from a HighLowDataset

getLowValue

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

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).
Throws:
java.lang.ClassCastException - if the series if not from a HighLowDataset

getOpenValue

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

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).
Throws:
java.lang.ClassCastException - if the series if not from a HighLowDataset

getCloseValue

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

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).
Throws:
java.lang.ClassCastException - if the series if not from a HighLowDataset

getVolumeValue

public java.lang.Number getVolumeValue(int series,
                                       int item)
Description copied from interface: HighLowDataset
Returns the volume for the specified series and item.

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

getXValue

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

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 an item within a series.
Throws:
java.lang.ClassCastException - if the series if not from a XYDataset

getYValue

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

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 an item within a series.
Throws:
java.lang.ClassCastException - if the series if not from a XYDataset

getItemCount

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

Specified by:
getItemCount in interface XYDataset
Parameters:
series - The index of the series of interest (zero-based);
Returns:
The number of items within a series.
Throws:
java.lang.ClassCastException - if the series if not from a XYDataset

addXYData

public void addXYData(int series,
                      java.lang.Object xObject,
                      java.lang.Object yObject,
                      int n)

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

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

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

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

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

getType

public int getType(int series,
                   int item)
Specified by:
getType in interface SignalsDataset

getLevel

public double getLevel(int series,
                       int item)
Specified by:
getLevel in interface SignalsDataset

getParent

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

Specified by:
getParent in interface CombinationDataset

getMap

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

Specified by:
getMap in interface CombinationDataset


Copyright © 2003 MBARI.

The Monterey Bay Aquarium Research Institute (MBARI) provides this documentation and code "as is", with no warranty, express or implied, of its quality or consistency. It is provided without support and without obligation on the part of MBARI to assist in its use, correction, modification, or enhancement.