Module org.jfree.chart
Package org.jfree.data.xy
Class DefaultIntervalXYDataset<S extends Comparable<S>>
- java.lang.Object
-
- org.jfree.data.general.AbstractDataset
-
- org.jfree.data.general.AbstractSeriesDataset<S>
-
- org.jfree.data.xy.AbstractXYDataset<S>
-
- org.jfree.data.xy.AbstractIntervalXYDataset<S>
-
- org.jfree.data.xy.DefaultIntervalXYDataset<S>
-
- All Implemented Interfaces:
ObjectInputValidation,Serializable,Cloneable,EventListener,PublicCloneable,Dataset,SeriesChangeListener,SeriesDataset<S>,IntervalXYDataset<S>,XYDataset<S>
public class DefaultIntervalXYDataset<S extends Comparable<S>> extends AbstractIntervalXYDataset<S> implements PublicCloneable
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 theIntervalXYDatasetinterface is provided by theXYIntervalSeriesCollectionclass.- Since:
- 1.0.3
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description DefaultIntervalXYDataset()Creates a newDefaultIntervalXYDatasetinstance, initially containing no data.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddSeries(S seriesKey, double[][] data)Adds a series or if a series with the same key already exists replaces the data for that series, then sends aDatasetChangeEventto all registered listeners.Objectclone()Returns a clone of this dataset.booleanequals(Object obj)Tests thisDefaultIntervalXYDatasetinstance for equality with an arbitrary object.NumbergetEndX(int series, int item)Returns the ending x-value for an item within a series.doublegetEndXValue(int series, int item)Returns the ending x-value for an item within a series.NumbergetEndY(int series, int item)Returns the ending y-value for an item within a series.doublegetEndYValue(int series, int item)Returns the ending y-value for an item within a series.intgetItemCount(int series)Returns the number of items in the specified series.intgetSeriesCount()Returns the number of series in the dataset.SgetSeriesKey(int series)Returns the key for a series.NumbergetStartX(int series, int item)Returns the starting x-value for an item within a series.doublegetStartXValue(int series, int item)Returns the starting x-value for an item within a series.NumbergetStartY(int series, int item)Returns the starting y-value for an item within a series.doublegetStartYValue(int series, int item)Returns the starting y-value for an item within a series.NumbergetX(int series, int item)Returns the x-value for an item within a series.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.doublegetYValue(int series, int item)Returns the y-value for an item within a series.inthashCode()Returns a hash code for this instance.-
Methods inherited from class org.jfree.data.xy.AbstractXYDataset
getDomainOrder
-
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
-
-
-
-
Constructor Detail
-
DefaultIntervalXYDataset
public DefaultIntervalXYDataset()
Creates a newDefaultIntervalXYDatasetinstance, initially containing no data.
-
-
Method Detail
-
getSeriesCount
public int getSeriesCount()
Returns the number of series in the dataset.- Specified by:
getSeriesCountin interfaceSeriesDataset<S extends Comparable<S>>- Specified by:
getSeriesCountin classAbstractSeriesDataset<S extends Comparable<S>>- Returns:
- The series count.
-
getSeriesKey
public S getSeriesKey(int series)
Returns the key for a series.- Specified by:
getSeriesKeyin interfaceSeriesDataset<S extends Comparable<S>>- Specified by:
getSeriesKeyin classAbstractSeriesDataset<S extends Comparable<S>>- Parameters:
series- the series index (in the range0togetSeriesCount() - 1).- Returns:
- The key for the 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<S extends Comparable<S>>- Parameters:
series- the series index (in the range0togetSeriesCount() - 1).- Returns:
- The item count.
- Throws:
IllegalArgumentException- ifseriesis not in the specified range.
-
getXValue
public double getXValue(int series, int item)
Returns the x-value for an item within a series.- Specified by:
getXValuein interfaceXYDataset<S extends Comparable<S>>- Overrides:
getXValuein classAbstractXYDataset<S extends Comparable<S>>- Parameters:
series- the series index (in the range0togetSeriesCount() - 1).item- the item index (in the range0togetItemCount(series)).- Returns:
- The x-value.
- Throws:
ArrayIndexOutOfBoundsException- ifseriesis not within the specified range.ArrayIndexOutOfBoundsException- ifitemis not within the specified range.- See Also:
getX(int, int)
-
getYValue
public double getYValue(int series, int item)
Returns the y-value for an item within a series.- Specified by:
getYValuein interfaceXYDataset<S extends Comparable<S>>- Overrides:
getYValuein classAbstractXYDataset<S extends Comparable<S>>- Parameters:
series- the series index (in the range0togetSeriesCount() - 1).item- the item index (in the range0togetItemCount(series)).- Returns:
- The y-value.
- Throws:
ArrayIndexOutOfBoundsException- ifseriesis not within the specified range.ArrayIndexOutOfBoundsException- ifitemis not within the specified range.- See Also:
getY(int, int)
-
getStartXValue
public double getStartXValue(int series, int item)
Returns the starting x-value for an item within a series.- Specified by:
getStartXValuein interfaceIntervalXYDataset<S extends Comparable<S>>- Overrides:
getStartXValuein classAbstractIntervalXYDataset<S extends Comparable<S>>- Parameters:
series- the series index (in the range0togetSeriesCount() - 1).item- the item index (in the range0togetItemCount(series)).- Returns:
- The starting x-value.
- Throws:
ArrayIndexOutOfBoundsException- ifseriesis not within the specified range.ArrayIndexOutOfBoundsException- ifitemis not within the specified range.- See Also:
getStartX(int, int)
-
getEndXValue
public double getEndXValue(int series, int item)
Returns the ending x-value for an item within a series.- Specified by:
getEndXValuein interfaceIntervalXYDataset<S extends Comparable<S>>- Overrides:
getEndXValuein classAbstractIntervalXYDataset<S extends Comparable<S>>- Parameters:
series- the series index (in the range0togetSeriesCount() - 1).item- the item index (in the range0togetItemCount(series)).- Returns:
- The ending x-value.
- Throws:
ArrayIndexOutOfBoundsException- ifseriesis not within the specified range.ArrayIndexOutOfBoundsException- ifitemis not within the specified range.- See Also:
getEndX(int, int)
-
getStartYValue
public double getStartYValue(int series, int item)
Returns the starting y-value for an item within a series.- Specified by:
getStartYValuein interfaceIntervalXYDataset<S extends Comparable<S>>- Overrides:
getStartYValuein classAbstractIntervalXYDataset<S extends Comparable<S>>- Parameters:
series- the series index (in the range0togetSeriesCount() - 1).item- the item index (in the range0togetItemCount(series)).- Returns:
- The starting y-value.
- Throws:
ArrayIndexOutOfBoundsException- ifseriesis not within the specified range.ArrayIndexOutOfBoundsException- ifitemis not within the specified range.- See Also:
getStartY(int, int)
-
getEndYValue
public double getEndYValue(int series, int item)
Returns the ending y-value for an item within a series.- Specified by:
getEndYValuein interfaceIntervalXYDataset<S extends Comparable<S>>- Overrides:
getEndYValuein classAbstractIntervalXYDataset<S extends Comparable<S>>- Parameters:
series- the series index (in the range0togetSeriesCount() - 1).item- the item index (in the range0togetItemCount(series)).- Returns:
- The ending y-value.
- Throws:
ArrayIndexOutOfBoundsException- ifseriesis not within the specified range.ArrayIndexOutOfBoundsException- ifitemis not within the specified range.- See Also:
getEndY(int, int)
-
getEndX
public Number getEndX(int series, int item)
Returns the ending x-value for an item within a series.- Specified by:
getEndXin interfaceIntervalXYDataset<S extends Comparable<S>>- Parameters:
series- the series index (in the range0togetSeriesCount() - 1).item- the item index (in the range0togetItemCount(series)).- Returns:
- The ending x-value.
- Throws:
ArrayIndexOutOfBoundsException- ifseriesis not within the specified range.ArrayIndexOutOfBoundsException- ifitemis not within the specified range.- See Also:
getEndXValue(int, int)
-
getEndY
public Number getEndY(int series, int item)
Returns the ending y-value for an item within a series.- Specified by:
getEndYin interfaceIntervalXYDataset<S extends Comparable<S>>- Parameters:
series- the series index (in the range0togetSeriesCount() - 1).item- the item index (in the range0togetItemCount(series)).- Returns:
- The ending y-value.
- Throws:
ArrayIndexOutOfBoundsException- ifseriesis not within the specified range.ArrayIndexOutOfBoundsException- ifitemis not within the specified range.- See Also:
getEndYValue(int, int)
-
getStartX
public Number getStartX(int series, int item)
Returns the starting x-value for an item within a series.- Specified by:
getStartXin interfaceIntervalXYDataset<S extends Comparable<S>>- Parameters:
series- the series index (in the range0togetSeriesCount() - 1).item- the item index (in the range0togetItemCount(series)).- Returns:
- The starting x-value.
- Throws:
ArrayIndexOutOfBoundsException- ifseriesis not within the specified range.ArrayIndexOutOfBoundsException- ifitemis not within the specified range.- See Also:
getStartXValue(int, int)
-
getStartY
public Number getStartY(int series, int item)
Returns the starting y-value for an item within a series.- Specified by:
getStartYin interfaceIntervalXYDataset<S extends Comparable<S>>- Parameters:
series- the series index (in the range0togetSeriesCount() - 1).item- the item index (in the range0togetItemCount(series)).- Returns:
- The starting y-value.
- Throws:
ArrayIndexOutOfBoundsException- ifseriesis not within the specified range.ArrayIndexOutOfBoundsException- ifitemis not within the specified range.- See Also:
getStartYValue(int, int)
-
getX
public Number getX(int series, int item)
Returns the x-value for an item within a series.- Specified by:
getXin interfaceXYDataset<S extends Comparable<S>>- Parameters:
series- the series index (in the range0togetSeriesCount() - 1).item- the item index (in the range0togetItemCount(series)).- Returns:
- The x-value.
- Throws:
ArrayIndexOutOfBoundsException- ifseriesis not within the specified range.ArrayIndexOutOfBoundsException- ifitemis not within the specified range.- See Also:
getXValue(int, int)
-
getY
public Number getY(int series, int item)
Returns the y-value for an item within a series.- Specified by:
getYin interfaceXYDataset<S extends Comparable<S>>- Parameters:
series- the series index (in the range0togetSeriesCount() - 1).item- the item index (in the range0togetItemCount(series)).- Returns:
- The y-value.
- Throws:
ArrayIndexOutOfBoundsException- ifseriesis not within the specified range.ArrayIndexOutOfBoundsException- ifitemis not within the specified range.- See Also:
getYValue(int, int)
-
addSeries
public void addSeries(S seriesKey, double[][] data)
Adds a series or if a series with the same key already exists replaces the data for that series, then sends aDatasetChangeEventto all registered listeners.- Parameters:
seriesKey- the series key (nullnot permitted).data- the data (must be an array with length 6, containing six arrays of equal length, the first three containing the x-values (x, xLow and xHigh) and the last three containing the y-values (y, yLow and yHigh)).
-
equals
public boolean equals(Object obj)
Tests thisDefaultIntervalXYDatasetinstance for equality with an arbitrary object. This method returnstrueif and only if:objis notnull;objis an instance ofDefaultIntervalXYDataset;- both datasets have the same number of series, each containing exactly the same values.
-
hashCode
public int hashCode()
Returns a hash code for this instance.
-
clone
public Object clone() throws CloneNotSupportedException
Returns a clone of this dataset.- Specified by:
clonein interfacePublicCloneable- Overrides:
clonein classAbstractDataset- Returns:
- A clone.
- Throws:
CloneNotSupportedException- if the dataset contains a series with a key that cannot be cloned.
-
-