- java.lang.Object
-
- org.jfree.data.general.AbstractDataset
-
- org.jfree.data.general.AbstractSeriesDataset<S>
-
- org.jfree.data.xy.AbstractXYDataset<S>
-
- org.jfree.data.xy.AbstractXYZDataset<S>
-
- org.jfree.data.xy.DefaultXYZDataset<S>
-
- All Implemented Interfaces:
ObjectInputValidation,Serializable,Cloneable,EventListener,PublicCloneable,Dataset,SeriesChangeListener,SeriesDataset<S>,XYDataset<S>,XYZDataset<S>
public class DefaultXYZDataset<S extends Comparable<S>> extends AbstractXYZDataset<S> implements XYZDataset<S>, PublicCloneable
A default implementation of theXYZDatasetinterface that stores data values in arrays of double primitives.- Since:
- 1.0.2
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description DefaultXYZDataset()Creates a newDefaultXYZDatasetinstance, 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()Creates an independent copy of this dataset.booleanequals(Object obj)Tests thisDefaultXYZDatasetinstance for equality with an arbitrary object.DomainOrdergetDomainOrder()Returns the order of the domain (x-) values in the dataset.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.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.NumbergetZ(int series, int item)Returns the z-value for an item within a series.doublegetZValue(int series, int item)Returns the z-value for an item within a series.inthashCode()Returns a hash code for this instance.intindexOf(S seriesKey)Returns the index of the series with the specified key, or -1 if there is no such series in the dataset.voidremoveSeries(S seriesKey)Removes a series from the dataset, then sends aDatasetChangeEventto all registered listeners.-
Methods inherited from class org.jfree.data.general.AbstractSeriesDataset
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
-
-
-
-
Constructor Detail
-
DefaultXYZDataset
public DefaultXYZDataset()
Creates a newDefaultXYZDatasetinstance, 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.
-
indexOf
public int indexOf(S seriesKey)
Returns the index of the series with the specified key, or -1 if there is no such series in the dataset.- Specified by:
indexOfin interfaceSeriesDataset<S extends Comparable<S>>- Overrides:
indexOfin classAbstractSeriesDataset<S extends Comparable<S>>- Parameters:
seriesKey- the series key (nullpermitted).- Returns:
- The index, or -1.
-
getDomainOrder
public DomainOrder getDomainOrder()
Returns the order of the domain (x-) values in the dataset. In this implementation, we cannot guarantee that the x-values are ordered, so this method returnsDomainOrder.NONE.- Specified by:
getDomainOrderin interfaceXYDataset<S extends Comparable<S>>- Overrides:
getDomainOrderin classAbstractXYDataset<S extends Comparable<S>>- Returns:
DomainOrder.NONE.
-
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)
-
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)
-
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)
-
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:
getX(int, int)
-
getZValue
public double getZValue(int series, int item)
Returns the z-value for an item within a series.- Specified by:
getZValuein interfaceXYZDataset<S extends Comparable<S>>- Overrides:
getZValuein classAbstractXYZDataset<S extends Comparable<S>>- Parameters:
series- the series index (in the range0togetSeriesCount() - 1).item- the item index (in the range0togetItemCount(series)).- Returns:
- The z-value.
- Throws:
ArrayIndexOutOfBoundsException- ifseriesis not within the specified range.ArrayIndexOutOfBoundsException- ifitemis not within the specified range.- See Also:
getZ(int, int)
-
getZ
public Number getZ(int series, int item)
Returns the z-value for an item within a series.- Specified by:
getZin interfaceXYZDataset<S extends Comparable<S>>- Parameters:
series- the series index (in the range0togetSeriesCount() - 1).item- the item index (in the range0togetItemCount(series)).- Returns:
- The z-value.
- Throws:
ArrayIndexOutOfBoundsException- ifseriesis not within the specified range.ArrayIndexOutOfBoundsException- ifitemis not within the specified range.- See Also:
getZ(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 3, containing three arrays of equal length, the first containing the x-values, the second containing the y-values and the third containing the z-values).
-
removeSeries
public void removeSeries(S seriesKey)
Removes a series from the dataset, then sends aDatasetChangeEventto all registered listeners.- Parameters:
seriesKey- the series key (nullnot permitted).
-
equals
public boolean equals(Object obj)
Tests thisDefaultXYZDatasetinstance for equality with an arbitrary object. This method returnstrueif and only if:objis notnull;objis an instance ofDefaultXYZDataset;- 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
Creates an independent copy of this dataset.- Specified by:
clonein interfacePublicCloneable- Overrides:
clonein classAbstractDataset- Returns:
- The cloned dataset.
- Throws:
CloneNotSupportedException- if there is a problem cloning the dataset (for instance, if a non-cloneable object is used for a series key).
-
-