Header
And More


org.jfree.data.xy
Class DefaultOHLCDataset

java.lang.Object
  extended by org.jfree.data.general.AbstractDataset
      extended by org.jfree.data.general.AbstractSeriesDataset
          extended by org.jfree.data.xy.AbstractXYDataset
              extended by org.jfree.data.xy.DefaultOHLCDataset
All Implemented Interfaces:
java.io.ObjectInputValidation, java.io.Serializable, java.lang.Cloneable, java.util.EventListener, Dataset, SeriesChangeListener, SeriesDataset, OHLCDataset, XYDataset, org.jfree.util.PublicCloneable

public class DefaultOHLCDataset
extends AbstractXYDataset
implements OHLCDataset, org.jfree.util.PublicCloneable

A simple implementation of the OHLCDataset interface. This implementation supports only one series.

See Also:
Serialized Form

Constructor Summary
DefaultOHLCDataset(java.lang.Comparable key, OHLCDataItem[] data)
          Creates a new dataset.
 
Method Summary
 java.lang.Object clone()
          Returns an independent copy of this dataset.
 boolean equals(java.lang.Object obj)
          Tests this instance for equality with an arbitrary object.
 java.lang.Number getClose(int series, int item)
          Returns the close value.
 double getCloseValue(int series, int item)
          Returns the close-value (as a double primitive) for an item within a series.
 java.lang.Number getHigh(int series, int item)
          Returns the high value.
 double getHighValue(int series, int item)
          Returns the high-value (as a double primitive) for an item within a series.
 int getItemCount(int series)
          Returns the item count for the specified series.
 java.lang.Number getLow(int series, int item)
          Returns the low value.
 double getLowValue(int series, int item)
          Returns the low-value (as a double primitive) for an item within a series.
 java.lang.Number getOpen(int series, int item)
          Returns the open value.
 double getOpenValue(int series, int item)
          Returns the open-value (as a double primitive) for an item within a series.
 int getSeriesCount()
          Returns the series count.
 java.lang.Comparable getSeriesKey(int series)
          Returns the series key.
 java.lang.Number getVolume(int series, int item)
          Returns the trading volume.
 double getVolumeValue(int series, int item)
          Returns the volume-value (as a double primitive) for an item within a series.
 java.lang.Number getX(int series, int item)
          Returns the x-value for a data item.
 java.util.Date getXDate(int series, int item)
          Returns the x-value for a data item as a date.
 java.lang.Number getY(int series, int item)
          Returns the y-value.
 void sortDataByDate()
          Sorts the data into ascending order by date.
 
Methods inherited from class org.jfree.data.xy.AbstractXYDataset
getDomainOrder, getXValue, getYValue
 
Methods inherited from class org.jfree.data.general.AbstractSeriesDataset
indexOf, seriesChanged
 
Methods inherited from class org.jfree.data.general.AbstractDataset
addChangeListener, fireDatasetChanged, getGroup, hasListener, notifyListeners, removeChangeListener, setGroup, validateObject
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jfree.data.xy.XYDataset
getDomainOrder, getXValue, getYValue
 
Methods inherited from interface org.jfree.data.general.SeriesDataset
indexOf
 
Methods inherited from interface org.jfree.data.general.Dataset
addChangeListener, getGroup, removeChangeListener, setGroup
 

Constructor Detail

DefaultOHLCDataset

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

Parameters:
key - the series key.
data - the data items.
Method Detail

getSeriesKey

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

Specified by:
getSeriesKey in interface SeriesDataset
Specified by:
getSeriesKey in class AbstractSeriesDataset
Parameters:
series - the series index (ignored).
Returns:
The series key.

getX

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

Specified by:
getX in interface XYDataset
Parameters:
series - the series index (ignored).
item - the item index (zero-based).
Returns:
The x-value.

getXDate

public java.util.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 java.lang.Number getY(int series,
                             int item)
Returns the y-value.

Specified by:
getY in interface XYDataset
Parameters:
series - the series index (ignored).
item - the item index (zero-based).
Returns:
The y value.

getHigh

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

Specified by:
getHigh in interface OHLCDataset
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.

Specified by:
getHighValue in interface OHLCDataset
Parameters:
series - the series (zero-based index).
item - the item (zero-based index).
Returns:
The high-value.

getLow

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

Specified by:
getLow in interface OHLCDataset
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.

Specified by:
getLowValue in interface OHLCDataset
Parameters:
series - the series (zero-based index).
item - the item (zero-based index).
Returns:
The low-value.

getOpen

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

Specified by:
getOpen in interface OHLCDataset
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.

Specified by:
getOpenValue in interface OHLCDataset
Parameters:
series - the series (zero-based index).
item - the item (zero-based index).
Returns:
The open-value.

getClose

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

Specified by:
getClose in interface OHLCDataset
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.

Specified by:
getCloseValue in interface OHLCDataset
Parameters:
series - the series (zero-based index).
item - the item (zero-based index).
Returns:
The close-value.

getVolume

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

Specified by:
getVolume in interface OHLCDataset
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.

Specified by:
getVolumeValue in interface OHLCDataset
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.


equals

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

Overrides:
equals in class java.lang.Object
Parameters:
obj - the object (null permitted).
Returns:
A boolean.

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Returns an independent copy of this dataset.

Specified by:
clone in interface org.jfree.util.PublicCloneable
Overrides:
clone in class AbstractDataset
Returns:
A clone.
Throws:
java.lang.CloneNotSupportedException

Footer
And More


Copyright © 2000-2009 by Object Refinery Limited. All Rights Reserved.