- java.lang.Object
-
- org.jfree.data.general.AbstractDataset
-
- org.jfree.data.general.AbstractSeriesDataset<S>
-
- org.jfree.data.xy.AbstractXYDataset
-
- org.jfree.data.time.ohlc.OHLCSeriesCollection
-
- All Implemented Interfaces:
ObjectInputValidation,Serializable,Cloneable,EventListener,Dataset,SeriesChangeListener,SeriesDataset,OHLCDataset,XYDataset
public class OHLCSeriesCollection extends AbstractXYDataset implements OHLCDataset, Serializable
A collection ofOHLCSeriesobjects.- Since:
- 1.0.4
- See Also:
OHLCSeries, Serialized Form
-
-
Constructor Summary
Constructors Constructor Description OHLCSeriesCollection()Creates a new instance ofOHLCSeriesCollection.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddSeries(OHLCSeries series)Adds a series to the collection and sends aDatasetChangeEventto all registered listeners.Objectclone()Returns a clone of this instance.booleanequals(Object obj)Tests this instance for equality with an arbitrary object.NumbergetClose(int series, int item)Returns the close-value for an item within a series.doublegetCloseValue(int series, int item)Returns the close-value for an item within a series.NumbergetHigh(int series, int item)Returns the high-value for an item within a series.doublegetHighValue(int series, int item)Returns the high-value for an item within a series.intgetItemCount(int series)Returns the number of items in the specified series.NumbergetLow(int series, int item)Returns the low-value for an item within a series.doublegetLowValue(int series, int item)Returns the low-value for an item within a series.NumbergetOpen(int series, int item)Returns the open-value for an item within a series.doublegetOpenValue(int series, int item)Returns the open-value for an item within a series.OHLCSeriesgetSeries(int series)Returns a series from the collection.intgetSeriesCount()Returns the number of series in the collection.ComparablegetSeriesKey(int series)Returns the key for a series.NumbergetVolume(int series, int item)Returnsnullalways, because this dataset doesn't record any volume data.doublegetVolumeValue(int series, int item)ReturnsDouble.NaNalways, because this dataset doesn't record any volume data.NumbergetX(int series, int item)Returns the x-value for an item within a series.protected longgetX(RegularTimePeriod period)Returns the x-value for a time period.TimePeriodAnchorgetXPosition()Returns the position within each time period that is used for the X value when the collection is used as anXYDataset.doublegetXValue(int series, int item)Returns the x-value for an item within a series.NumbergetY(int series, int item)Returns the y-value for an item within a series.inthashCode()Returns a hash code for this instance.voidremoveAllSeries()Removes all the series from the collection and sends aDatasetChangeEventto all registered listeners.voidremoveSeries(int index)Removes the series with the specified index and sends aDatasetChangeEventto all registered listeners.booleanremoveSeries(OHLCSeries series)Removes the specified series from the dataset and sends aDatasetChangeEventto all registered listeners.voidsetXPosition(TimePeriodAnchor anchor)Sets the position within each time period that is used for the X values when the collection is used as anXYDataset, then sends aDatasetChangeEventis sent to all registered listeners.-
Methods inherited from class org.jfree.data.xy.AbstractXYDataset
getDomainOrder, getYValue
-
Methods inherited from class org.jfree.data.general.AbstractSeriesDataset
indexOf, seriesChanged
-
Methods inherited from class org.jfree.data.general.AbstractDataset
addChangeListener, fireDatasetChanged, getNotify, hasListener, notifyListeners, removeChangeListener, setNotify, validateObject
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.jfree.data.general.Dataset
addChangeListener, removeChangeListener
-
Methods inherited from interface org.jfree.data.general.SeriesDataset
indexOf
-
Methods inherited from interface org.jfree.data.xy.XYDataset
getDomainOrder, getYValue
-
-
-
-
Constructor Detail
-
OHLCSeriesCollection
public OHLCSeriesCollection()
Creates a new instance ofOHLCSeriesCollection.
-
-
Method Detail
-
getXPosition
public TimePeriodAnchor getXPosition()
Returns the position within each time period that is used for the X value when the collection is used as anXYDataset.- Returns:
- The anchor position (never
null). - Since:
- 1.0.11
-
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 anXYDataset, then sends aDatasetChangeEventis sent to all registered listeners.- Parameters:
anchor- the anchor position (nullnot permitted).- Since:
- 1.0.11
-
addSeries
public void addSeries(OHLCSeries series)
Adds a series to the collection and sends aDatasetChangeEventto all registered listeners.- Parameters:
series- the series (nullnot permitted).
-
getSeriesCount
public int getSeriesCount()
Returns the number of series in the collection.- Specified by:
getSeriesCountin interfaceSeriesDataset- Specified by:
getSeriesCountin classAbstractSeriesDataset- Returns:
- The series count.
-
getSeries
public OHLCSeries getSeries(int series)
Returns a series from the collection.- Parameters:
series- the series index (zero-based).- Returns:
- The series.
- Throws:
IllegalArgumentException- ifseriesis not in the range0togetSeriesCount() - 1.
-
getSeriesKey
public Comparable getSeriesKey(int series)
Returns the key for a series.- Specified by:
getSeriesKeyin interfaceSeriesDataset- Specified by:
getSeriesKeyin classAbstractSeriesDataset- Parameters:
series- the series index (in the range0togetSeriesCount() - 1).- Returns:
- The key for a series.
- Throws:
IllegalArgumentException- ifseriesis not in the specified range.
-
getItemCount
public int getItemCount(int series)
Returns the number of items in the specified series.- Specified by:
getItemCountin interfaceXYDataset- Parameters:
series- the series (zero-based index).- Returns:
- The item count.
- Throws:
IllegalArgumentException- ifseriesis not in the range0togetSeriesCount() - 1.
-
getX
protected long getX(RegularTimePeriod period)
Returns the x-value for a time period.- Parameters:
period- the time period (nullnot permitted).- Returns:
- The x-value.
-
getXValue
public double getXValue(int series, int item)
Returns the x-value for an item within a series.- Specified by:
getXValuein interfaceXYDataset- Overrides:
getXValuein classAbstractXYDataset- Parameters:
series- the series index.item- the item index.- Returns:
- The x-value.
-
getOpenValue
public double getOpenValue(int series, int item)
Returns the open-value for an item within a series.- Specified by:
getOpenValuein interfaceOHLCDataset- Parameters:
series- the series index.item- the item index.- Returns:
- The open-value.
-
getOpen
public Number getOpen(int series, int item)
Returns the open-value for an item within a series.- Specified by:
getOpenin interfaceOHLCDataset- Parameters:
series- the series index.item- the item index.- Returns:
- The open-value.
-
getCloseValue
public double getCloseValue(int series, int item)
Returns the close-value for an item within a series.- Specified by:
getCloseValuein interfaceOHLCDataset- Parameters:
series- the series index.item- the item index.- Returns:
- The close-value.
-
getClose
public Number getClose(int series, int item)
Returns the close-value for an item within a series.- Specified by:
getClosein interfaceOHLCDataset- Parameters:
series- the series index.item- the item index.- Returns:
- The close-value.
-
getHighValue
public double getHighValue(int series, int item)
Returns the high-value for an item within a series.- Specified by:
getHighValuein interfaceOHLCDataset- Parameters:
series- the series index.item- the item index.- Returns:
- The high-value.
-
getHigh
public Number getHigh(int series, int item)
Returns the high-value for an item within a series.- Specified by:
getHighin interfaceOHLCDataset- Parameters:
series- the series index.item- the item index.- Returns:
- The high-value.
-
getLowValue
public double getLowValue(int series, int item)
Returns the low-value for an item within a series.- Specified by:
getLowValuein interfaceOHLCDataset- Parameters:
series- the series index.item- the item index.- Returns:
- The low-value.
-
getLow
public Number getLow(int series, int item)
Returns the low-value for an item within a series.- Specified by:
getLowin interfaceOHLCDataset- Parameters:
series- the series index.item- the item index.- Returns:
- The low-value.
-
getVolume
public Number getVolume(int series, int item)
Returnsnullalways, because this dataset doesn't record any volume data.- Specified by:
getVolumein interfaceOHLCDataset- Parameters:
series- the series index (ignored).item- the item index (ignored).- Returns:
null.
-
getVolumeValue
public double getVolumeValue(int series, int item)
ReturnsDouble.NaNalways, because this dataset doesn't record any volume data.- Specified by:
getVolumeValuein interfaceOHLCDataset- Parameters:
series- the series index (ignored).item- the item index (ignored).- Returns:
Double.NaN.
-
removeSeries
public void removeSeries(int index)
Removes the series with the specified index and sends aDatasetChangeEventto all registered listeners.- Parameters:
index- the series index.- Since:
- 1.0.14
-
removeSeries
public boolean removeSeries(OHLCSeries series)
Removes the specified series from the dataset and sends aDatasetChangeEventto all registered listeners.- Parameters:
series- the series (nullnot permitted).- Returns:
trueif the series was removed, andfalseotherwise.- Since:
- 1.0.14
-
removeAllSeries
public void removeAllSeries()
Removes all the series from the collection and sends aDatasetChangeEventto all registered listeners.- Since:
- 1.0.14
-
equals
public boolean equals(Object obj)
Tests this instance for equality with an arbitrary object.
-
hashCode
public int hashCode()
Returns a hash code for this instance.
-
clone
public Object clone() throws CloneNotSupportedException
Returns a clone of this instance.- Overrides:
clonein classAbstractDataset- Returns:
- A clone.
- Throws:
CloneNotSupportedException- if there is a problem.
-
-