Class OHLCDataset

All Implemented Interfaces:
ObjectInputValidation, Serializable, Cloneable, EventListener, Dataset, HighLowDataset, SeriesChangeListener, SeriesDataset, XYDataset

public class OHLCDataset
extends AbstractXYDataset
implements HighLowDataset
A simple implementation of the HighLowDataset interface. This implementation supports only one series.
See Also:
Serialized Form
  • Constructor Details

    • OHLCDataset

      public OHLCDataset​(String name, OHLCDataItem[] data)
      Creates a new dataset.
      Parameters:
      name - the series name.
      data - the data items.
  • Method Details

    • getSeriesName

      public String getSeriesName​(int series)
      Returns the series name.
      Specified by:
      getSeriesName in interface SeriesDataset
      Specified by:
      getSeriesName in class AbstractSeriesDataset
      Parameters:
      series - the series index (ignored).
      Returns:
      the series name.
    • getXValue

      public Number getXValue​(int series, int item)
      Returns the x-value for a data item.
      Specified by:
      getXValue in interface XYDataset
      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.
    • getYValue

      public Number getYValue​(int series, int item)
      Returns the y-value.
      Specified by:
      getYValue in interface XYDataset
      Parameters:
      series - the series index (ignored).
      item - the item index (zero-based).
      Returns:
      the y value.
    • getHighValue

      public Number getHighValue​(int series, int item)
      Returns the high value.
      Specified by:
      getHighValue in interface HighLowDataset
      Parameters:
      series - the series index (ignored).
      item - the item index (zero-based).
      Returns:
      the high value.
    • 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 Number getLowValue​(int series, int item)
      Returns the low value.
      Specified by:
      getLowValue in interface HighLowDataset
      Parameters:
      series - the series index (ignored).
      item - the item index (zero-based).
      Returns:
      the low value.
    • 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 Number getOpenValue​(int series, int item)
      Returns the open value.
      Specified by:
      getOpenValue in interface HighLowDataset
      Parameters:
      series - the series index (ignored).
      item - the item index (zero-based).
      Returns:
      the open value.
    • 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 Number getCloseValue​(int series, int item)
      Returns the close value.
      Specified by:
      getCloseValue in interface HighLowDataset
      Parameters:
      series - the series index (ignored).
      item - the item index (zero-based).
      Returns:
      the close value.
    • 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 Number getVolumeValue​(int series, int item)
      Returns the trading volume.
      Specified by:
      getVolumeValue in interface HighLowDataset
      Parameters:
      series - the series index (ignored).
      item - the item index (zero-based).
      Returns:
      the trading 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.
    • getSeriesCount

      public int getSeriesCount()
      Returns the series count.
      Specified by:
      getSeriesCount in interface SeriesDataset
      Specified by:
      getSeriesCount in class AbstractSeriesDataset
      Returns:
      1.
    • getItemCount

      public int getItemCount​(int series)
      Returns the item count for the specified series.
      Specified by:
      getItemCount in interface XYDataset
      Parameters:
      series - the series index (ignored).
      Returns:
      the item count.
    • sortDataByDate

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