org.jfree.data.xy

Class DefaultIntervalXYDataset

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

public class DefaultIntervalXYDataset
extends AbstractIntervalXYDataset

A dataset that defines a range (interval) for both the x-values and the y-values. This implementation uses six arrays to store the x, start-x, end-x, y, start-y and end-y values.

An alternative implementation of the IntervalXYDataset interface is provided by the XYIntervalSeriesCollection class.
Since:
1.0.3

Constructor Summary

DefaultIntervalXYDataset()
Creates a new DefaultIntervalXYDataset instance, initially containing no data.

Method Summary

void
addSeries(Comparable seriesKey, double[][] data)
Adds a series or if a series with the same key already exists replaces the data for that series, then sends a DatasetChangeEvent to all registered listeners.
Object
clone()
Returns a clone of this dataset.
boolean
equals(Object obj)
Tests this DefaultIntervalXYDataset instance for equality with an arbitrary object.
Number
getEndX(int series, int item)
Returns the ending x-value for an item within a series.
double
getEndXValue(int series, int item)
Returns the ending x-value for an item within a series.
Number
getEndY(int series, int item)
Returns the ending y-value for an item within a series.
double
getEndYValue(int series, int item)
Returns the ending y-value for an item within a series.
int
getItemCount(int series)
Returns the number of items in the specified series.
int
getSeriesCount()
Returns the number of series in the dataset.
Comparable
getSeriesKey(int series)
Returns the key for a series.
Number
getStartX(int series, int item)
Returns the starting x-value for an item within a series.
double
getStartXValue(int series, int item)
Returns the starting x-value for an item within a series.
Number
getStartY(int series, int item)
Returns the starting y-value for an item within a series.
double
getStartYValue(int series, int item)
Returns the starting y-value for an item within a series.
Number
getX(int series, int item)
Returns the x-value for an item within a series.
double
getXValue(int series, int item)
Returns the x-value for an item within a series.
Number
getY(int series, int item)
Returns the y-value for an item within a series.
double
getYValue(int series, int item)
Returns the y-value for an item within a series.
int
hashCode()
Returns a hash code for this instance.

Methods inherited from class org.jfree.data.xy.AbstractIntervalXYDataset

getEndXValue, getEndYValue, getStartXValue, getStartYValue

Methods inherited from class org.jfree.data.xy.AbstractXYDataset

getDomainOrder, getXValue, getYValue

Methods inherited from class org.jfree.data.general.AbstractSeriesDataset

getSeriesCount, getSeriesKey, indexOf, seriesChanged

Methods inherited from class org.jfree.data.general.AbstractDataset

addChangeListener, clone, fireDatasetChanged, getGroup, hasListener, notifyListeners, removeChangeListener, setGroup, validateObject

Constructor Details

DefaultIntervalXYDataset

public DefaultIntervalXYDataset()
Creates a new DefaultIntervalXYDataset instance, initially containing no data.

Method Details

addSeries

public void addSeries(Comparable seriesKey,
                      double[][] data)
Adds a series or if a series with the same key already exists replaces the data for that series, then sends a DatasetChangeEvent to all registered listeners.
Parameters:
seriesKey - the series key (null not permitted).
data - the data (must be an array with length 6, containing six arrays of equal length, the first containing the x-values and the second containing the y-values).

clone

public Object clone()
            throws CloneNotSupportedException
Returns a clone of this dataset.
Overrides:
clone in interface AbstractDataset
Returns:
A clone.

equals

public boolean equals(Object obj)
Tests this DefaultIntervalXYDataset instance for equality with an arbitrary object. This method returns true if and only if:
  • obj is not null;
  • obj is an instance of DefaultIntervalXYDataset;
  • both datasets have the same number of series, each containing exactly the same values.
Parameters:
obj - the object (null permitted).
Returns:
A boolean.

getEndX

public Number getEndX(int series,
                      int item)
Returns the ending x-value for an item within a series.
Specified by:
getEndX in interface IntervalXYDataset
Parameters:
series - the series index (in the range 0 to getSeriesCount() - 1).
item - the item index (in the range 0 to getItemCount(series)).
Returns:
The ending x-value.

getEndXValue

public double getEndXValue(int series,
                           int item)
Returns the ending x-value for an item within a series.
Specified by:
getEndXValue in interface IntervalXYDataset
Overrides:
getEndXValue in interface AbstractIntervalXYDataset
Parameters:
series - the series index (in the range 0 to getSeriesCount() - 1).
item - the item index (in the range 0 to getItemCount(series)).
Returns:
The ending x-value.

getEndY

public Number getEndY(int series,
                      int item)
Returns the ending y-value for an item within a series.
Specified by:
getEndY in interface IntervalXYDataset
Parameters:
series - the series index (in the range 0 to getSeriesCount() - 1).
item - the item index (in the range 0 to getItemCount(series)).
Returns:
The ending y-value.

getEndYValue

public double getEndYValue(int series,
                           int item)
Returns the ending y-value for an item within a series.
Specified by:
getEndYValue in interface IntervalXYDataset
Overrides:
getEndYValue in interface AbstractIntervalXYDataset
Parameters:
series - the series index (in the range 0 to getSeriesCount() - 1).
item - the item index (in the range 0 to getItemCount(series)).
Returns:
The ending y-value.

getItemCount

public int getItemCount(int series)
Returns the number of items in the specified series.
Specified by:
getItemCount in interface XYDataset
Parameters:
series - the series index (in the range 0 to getSeriesCount() - 1).
Returns:
The item count.

getSeriesCount

public int getSeriesCount()
Returns the number of series in the dataset.
Specified by:
getSeriesCount in interface SeriesDataset
Overrides:
getSeriesCount in interface AbstractSeriesDataset
Returns:
The series count.

getSeriesKey

public Comparable getSeriesKey(int series)
Returns the key for a series.
Specified by:
getSeriesKey in interface SeriesDataset
Overrides:
getSeriesKey in interface AbstractSeriesDataset
Parameters:
series - the series index (in the range 0 to getSeriesCount() - 1).
Returns:
The key for the series.

getStartX

public Number getStartX(int series,
                        int item)
Returns the starting x-value for an item within a series.
Specified by:
getStartX in interface IntervalXYDataset
Parameters:
series - the series index (in the range 0 to getSeriesCount() - 1).
item - the item index (in the range 0 to getItemCount(series)).
Returns:
The starting x-value.

getStartXValue

public double getStartXValue(int series,
                             int item)
Returns the starting x-value for an item within a series.
Specified by:
getStartXValue in interface IntervalXYDataset
Overrides:
getStartXValue in interface AbstractIntervalXYDataset
Parameters:
series - the series index (in the range 0 to getSeriesCount() - 1).
item - the item index (in the range 0 to getItemCount(series)).
Returns:
The starting x-value.

getStartY

public Number getStartY(int series,
                        int item)
Returns the starting y-value for an item within a series.
Specified by:
getStartY in interface IntervalXYDataset
Parameters:
series - the series index (in the range 0 to getSeriesCount() - 1).
item - the item index (in the range 0 to getItemCount(series)).
Returns:
The starting y-value.

getStartYValue

public double getStartYValue(int series,
                             int item)
Returns the starting y-value for an item within a series.
Specified by:
getStartYValue in interface IntervalXYDataset
Overrides:
getStartYValue in interface AbstractIntervalXYDataset
Parameters:
series - the series index (in the range 0 to getSeriesCount() - 1).
item - the item index (in the range 0 to getItemCount(series)).
Returns:
The starting y-value.

getX

public Number getX(int series,
                   int item)
Returns the x-value for an item within a series.
Specified by:
getX in interface XYDataset
Parameters:
series - the series index (in the range 0 to getSeriesCount() - 1).
item - the item index (in the range 0 to getItemCount(series)).
Returns:
The x-value.

getXValue

public double getXValue(int series,
                        int item)
Returns the x-value for an item within a series.
Specified by:
getXValue in interface XYDataset
Overrides:
getXValue in interface AbstractXYDataset
Parameters:
series - the series index (in the range 0 to getSeriesCount() - 1).
item - the item index (in the range 0 to getItemCount(series)).
Returns:
The x-value.
See Also:
getX(int,int)

getY

public Number getY(int series,
                   int item)
Returns the y-value for an item within a series.
Specified by:
getY in interface XYDataset
Parameters:
series - the series index (in the range 0 to getSeriesCount() - 1).
item - the item index (in the range 0 to getItemCount(series)).
Returns:
The y-value.

getYValue

public double getYValue(int series,
                        int item)
Returns the y-value for an item within a series.
Specified by:
getYValue in interface XYDataset
Overrides:
getYValue in interface AbstractXYDataset
Parameters:
series - the series index (in the range 0 to getSeriesCount() - 1).
item - the item index (in the range 0 to getItemCount(series)).
Returns:
The y-value.
See Also:
getY(int,int)

hashCode

public int hashCode()
Returns a hash code for this instance.
Returns:
A hash code.