org.jfree.data.xy

Class DefaultOHLCDataset

public class DefaultOHLCDataset extends AbstractXYDataset implements OHLCDataset

A simple implementation of the OHLCDataset interface. This implementation supports only one series.
Constructor Summary
DefaultOHLCDataset(Comparable key, OHLCDataItem[] data)
Creates a new dataset.
Method Summary
booleanequals(Object obj)
Tests this instance for equality with an arbitrary object.
NumbergetClose(int series, int item)
Returns the close value.
doublegetCloseValue(int series, int item)
Returns the close-value (as a double primitive) for an item within a series.
NumbergetHigh(int series, int item)
Returns the high value.
doublegetHighValue(int series, int item)
Returns the high-value (as a double primitive) for an item within a series.
intgetItemCount(int series)
Returns the item count for the specified series.
NumbergetLow(int series, int item)
Returns the low value.
doublegetLowValue(int series, int item)
Returns the low-value (as a double primitive) for an item within a series.
NumbergetOpen(int series, int item)
Returns the open value.
doublegetOpenValue(int series, int item)
Returns the open-value (as a double primitive) for an item within a series.
intgetSeriesCount()
Returns the series count.
ComparablegetSeriesKey(int series)
Returns the series key.
NumbergetVolume(int series, int item)
Returns the trading volume.
doublegetVolumeValue(int series, int item)
Returns the volume-value (as a double primitive) for an item within a series.
NumbergetX(int series, int item)
Returns the x-value for a data item.
DategetXDate(int series, int item)
Returns the x-value for a data item as a date.
NumbergetY(int series, int item)
Returns the y-value.
voidsortDataByDate()
Sorts the data into ascending order by date.

Constructor Detail

DefaultOHLCDataset

public DefaultOHLCDataset(Comparable key, OHLCDataItem[] data)
Creates a new dataset.

Parameters: key the series key. data the data items.

Method Detail

equals

public boolean equals(Object obj)
Tests this instance for equality with an arbitrary object.

Parameters: obj the object (null permitted).

Returns: A boolean.

getClose

public Number getClose(int series, int item)
Returns the close value.

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

Returns: The close value.

getCloseValue

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

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

Returns: The close-value.

getHigh

public Number getHigh(int series, int item)
Returns the high value.

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

Returns: The high value.

getHighValue

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

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

Returns: The high-value.

getItemCount

public int getItemCount(int series)
Returns the item count for the specified series.

Parameters: series the series index (ignored).

Returns: The item count.

getLow

public Number getLow(int series, int item)
Returns the low value.

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

Returns: The low value.

getLowValue

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

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

Returns: The low-value.

getOpen

public Number getOpen(int series, int item)
Returns the open value.

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

Returns: The open value.

getOpenValue

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

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

Returns: The open-value.

getSeriesCount

public int getSeriesCount()
Returns the series count.

Returns: 1.

getSeriesKey

public Comparable getSeriesKey(int series)
Returns the series key.

Parameters: series the series index (ignored).

Returns: The series key.

getVolume

public Number getVolume(int series, int item)
Returns the trading volume.

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

Returns: The trading volume.

getVolumeValue

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

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

Returns: The volume-value.

getX

public Number getX(int series, int item)
Returns the x-value for a data item.

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

Returns: The x-value.

getXDate

public Date getXDate(int series, int item)
Returns the x-value for a data item as a date.

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

Returns: The x-value as a date.

getY

public Number getY(int series, int item)
Returns the y-value.

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

Returns: The y value.

sortDataByDate

public void sortDataByDate()
Sorts the data into ascending order by date.