Package org.jfree.data
Class CombinedDataset
- All Implemented Interfaces:
ObjectInputValidation
,Serializable
,Cloneable
,EventListener
,CombinationDataset
,Dataset
,HighLowDataset
,IntervalXYDataset
,SeriesChangeListener
,SeriesDataset
,XYDataset
public class CombinedDataset extends AbstractIntervalXYDataset implements XYDataset, HighLowDataset, IntervalXYDataset, CombinationDataset
This class can combine instances of
XYDataset
, HighLowDataset
and IntervalXYDataset
together exposing the union of all the series
under one dataset.- Author:
- Bill Kelemen (bill@kelemen-usa.com)
- See Also:
- Serialized Form
-
Constructor Summary
Constructors Constructor Description CombinedDataset()
Default constructor for an empty combination.CombinedDataset(SeriesDataset[] data)
Creates a CombinedDataset initialized with an array of SeriesDatasets. -
Method Summary
Modifier and Type Method Description void
add(SeriesDataset data)
Adds one SeriesDataset to the combination.void
add(SeriesDataset[] data)
Adds an array of SeriesDataset's to the combination.void
add(SeriesDataset data, int series)
Adds one series from a SeriesDataset to the combination.int
getChildPosition(Dataset child)
Returns the child position.double
getClose(int series, int item)
Returns the close-value (as a double primitive) for an item within a series.Number
getCloseValue(int series, int item)
Returns the close-value for the specified series and item.Number
getEndXValue(int series, int item)
Returns the ending X value for the specified series and item.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.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
getLow(int series, int item)
Returns the low-value (as a double primitive) for an item within a series.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.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.String
getSeriesName(int series)
Returns the name of a series.Number
getStartXValue(int series, int item)
Returns the starting X value for the specified series and item.Number
getStartYValue(int series, int item)
Returns the starting Y value for the specified series and item.double
getVolume(int series, int item)
Returns the volume-value (as a double primitive) for an item within a series.Number
getVolumeValue(int series, int item)
Returns the volume value for the specified series and item.Number
getXValue(int series, int item)
Returns the X-value for the specified series and item.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, getGroup, removeChangeListener, setGroup, validateObject
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
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 Details
-
CombinedDataset
public CombinedDataset()Default constructor for an empty combination. -
CombinedDataset
Creates a CombinedDataset initialized with an array of SeriesDatasets.- Parameters:
data
- array of SeriesDataset that contains the SeriesDatasets to combine.
-
-
Method Details
-
add
Adds one SeriesDataset to the combination. Listeners are notified of the change.- Parameters:
data
- the SeriesDataset to add.
-
add
Adds an array of SeriesDataset's to the combination. Listeners are notified of the change.- Parameters:
data
- array of SeriesDataset to add
-
add
Adds one series from a SeriesDataset to the combination. Listeners are notified of the change.- Parameters:
data
- the SeriesDataset where series is containedseries
- series to add
-
getSeriesCount
public int getSeriesCount()Returns the number of series in the dataset.- Specified by:
getSeriesCount
in interfaceSeriesDataset
- Specified by:
getSeriesCount
in classAbstractSeriesDataset
- Returns:
- The number of series in the dataset.
-
getSeriesName
Returns the name of a series.- Specified by:
getSeriesName
in interfaceSeriesDataset
- Specified by:
getSeriesName
in classAbstractSeriesDataset
- Parameters:
series
- the series (zero-based index).- Returns:
- the name of a series.
-
getXValue
Returns the X-value for the specified series and item.Note: throws
ClassCastException
if the series is not from aXYDataset
. -
getYValue
Returns the Y-value for the specified series and item.Note: throws
ClassCastException
if the series is not from aXYDataset
. -
getItemCount
public int getItemCount(int series)Returns the number of items in a series.Note: throws
ClassCastException
if the series is not from aXYDataset
.- Specified by:
getItemCount
in interfaceXYDataset
- Parameters:
series
- the index of the series of interest (zero-based).- Returns:
- the number of items in a series.
-
getHighValue
Returns the high-value for the specified series and item.Note: throws
ClassCastException
if the series is not from aHighLowDataset
.- Specified by:
getHighValue
in interfaceHighLowDataset
- 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 interfaceHighLowDataset
- Parameters:
series
- the series (zero-based index).item
- the item (zero-based index).- Returns:
- The high-value.
-
getLowValue
Returns the low-value for the specified series and item.Note: throws
ClassCastException
if the series is not from aHighLowDataset
.- Specified by:
getLowValue
in interfaceHighLowDataset
- 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 interfaceHighLowDataset
- Parameters:
series
- the series (zero-based index).item
- the item (zero-based index).- Returns:
- The low-value.
-
getOpenValue
Returns the open-value for the specified series and item.Note: throws
ClassCastException
if the series is not from aHighLowDataset
.- Specified by:
getOpenValue
in interfaceHighLowDataset
- 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 interfaceHighLowDataset
- Parameters:
series
- the series (zero-based index).item
- the item (zero-based index).- Returns:
- The open-value.
-
getCloseValue
Returns the close-value for the specified series and item.Note: throws
ClassCastException
if the series is not from aHighLowDataset
.- Specified by:
getCloseValue
in interfaceHighLowDataset
- 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 interfaceHighLowDataset
- Parameters:
series
- the series (zero-based index).item
- the item (zero-based index).- Returns:
- The close-value.
-
getVolumeValue
Returns the volume value for the specified series and item.Note: throws
ClassCastException
if the series is not from aHighLowDataset
.- Specified by:
getVolumeValue
in interfaceHighLowDataset
- Parameters:
series
- the index of the series of interest (zero-based).item
- the index of the item of interest (zero-based).- Returns:
- the volume value for the specified series and item.
-
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 interfaceHighLowDataset
- Parameters:
series
- the series (zero-based index).item
- the item (zero-based index).- Returns:
- The volume-value.
-
getStartXValue
Returns the starting X value for the specified series and item.- Specified by:
getStartXValue
in interfaceIntervalXYDataset
- 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
Returns the ending X value for the specified series and item.- Specified by:
getEndXValue
in interfaceIntervalXYDataset
- 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
Returns the starting Y value for the specified series and item.- Specified by:
getStartYValue
in interfaceIntervalXYDataset
- 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
Returns the ending Y value for the specified series and item.- Specified by:
getEndYValue
in interfaceIntervalXYDataset
- 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.
-
getParent
Returns the parent Dataset of this combination. If there is more than one parent, or a child is found that is not a CombinationDataset, then returnsnull
.- Specified by:
getParent
in interfaceCombinationDataset
- Returns:
- the parent Dataset of this combination or
null
.
-
getMap
public int[] getMap()Returns a map or indirect indexing form our series into parent's series. Prior to calling this method, the client should check getParent() to make sure the CombinationDataset uses the same parent. If not, the map returned by this method will be invalid or null.- Specified by:
getMap
in interfaceCombinationDataset
- Returns:
- a map or indirect indexing form our series into parent's series.
- See Also:
getParent()
-
getChildPosition
Returns the child position.- Parameters:
child
- the child dataset.- Returns:
- the position.
-