Header
And More


org.jfree.data.xy
Class DefaultXYZDataset

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.AbstractXYZDataset
                  extended by org.jfree.data.xy.DefaultXYZDataset
All Implemented Interfaces:
java.io.ObjectInputValidation, java.io.Serializable, java.lang.Cloneable, java.util.EventListener, Dataset, SeriesChangeListener, SeriesDataset, XYDataset, XYZDataset, org.jfree.util.PublicCloneable

public class DefaultXYZDataset
extends AbstractXYZDataset
implements XYZDataset, org.jfree.util.PublicCloneable

A default implementation of the XYZDataset interface that stores data values in arrays of double primitives.

Since:
1.0.2
See Also:
Serialized Form

Constructor Summary
DefaultXYZDataset()
          Creates a new DefaultXYZDataset instance, initially containing no data.
 
Method Summary
 void addSeries(java.lang.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.
 java.lang.Object clone()
          Creates an independent copy of this dataset.
 boolean equals(java.lang.Object obj)
          Tests this DefaultXYDataset instance for equality with an arbitrary object.
 DomainOrder getDomainOrder()
          Returns the order of the domain (x-) values in the dataset.
 int getItemCount(int series)
          Returns the number of items in the specified series.
 int getSeriesCount()
          Returns the number of series in the dataset.
 java.lang.Comparable getSeriesKey(int series)
          Returns the key for a series.
 java.lang.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.
 java.lang.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.
 java.lang.Number getZ(int series, int item)
          Returns the z-value for an item within a series.
 double getZValue(int series, int item)
          Returns the z-value for an item within a series.
 int hashCode()
          Returns a hash code for this instance.
 int indexOf(java.lang.Comparable seriesKey)
          Returns the index of the series with the specified key, or -1 if there is no such series in the dataset.
 void removeSeries(java.lang.Comparable seriesKey)
          Removes a series from the dataset, then sends a DatasetChangeEvent to all registered listeners.
 
Methods inherited from class org.jfree.data.general.AbstractSeriesDataset
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, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jfree.data.general.Dataset
addChangeListener, getGroup, removeChangeListener, setGroup
 

Constructor Detail

DefaultXYZDataset

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

Method Detail

getSeriesCount

public int getSeriesCount()
Returns the number of series in the dataset.

Specified by:
getSeriesCount in interface SeriesDataset
Specified by:
getSeriesCount in class AbstractSeriesDataset
Returns:
The series count.

getSeriesKey

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

Specified by:
getSeriesKey in interface SeriesDataset
Specified by:
getSeriesKey in class AbstractSeriesDataset
Parameters:
series - the series index (in the range 0 to getSeriesCount() - 1).
Returns:
The key for the series.
Throws:
java.lang.IllegalArgumentException - if series is not in the specified range.

indexOf

public int indexOf(java.lang.Comparable seriesKey)
Returns the index of the series with the specified key, or -1 if there is no such series in the dataset.

Specified by:
indexOf in interface SeriesDataset
Overrides:
indexOf in class AbstractSeriesDataset
Parameters:
seriesKey - the series key (null permitted).
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 returns DomainOrder.NONE.

Specified by:
getDomainOrder in interface XYDataset
Overrides:
getDomainOrder in class AbstractXYDataset
Returns:
DomainOrder.NONE.

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.
Throws:
java.lang.IllegalArgumentException - if series is 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:
getXValue in interface XYDataset
Overrides:
getXValue in class 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.
Throws:
java.lang.ArrayIndexOutOfBoundsException - if series is not within the specified range.
java.lang.ArrayIndexOutOfBoundsException - if item is not within the specified range.
See Also:
getX(int, int)

getX

public java.lang.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.
Throws:
java.lang.ArrayIndexOutOfBoundsException - if series is not within the specified range.
java.lang.ArrayIndexOutOfBoundsException - if item is 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:
getYValue in interface XYDataset
Overrides:
getYValue in class 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.
Throws:
java.lang.ArrayIndexOutOfBoundsException - if series is not within the specified range.
java.lang.ArrayIndexOutOfBoundsException - if item is not within the specified range.
See Also:
getY(int, int)

getY

public java.lang.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.
Throws:
java.lang.ArrayIndexOutOfBoundsException - if series is not within the specified range.
java.lang.ArrayIndexOutOfBoundsException - if item is 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:
getZValue in interface XYZDataset
Overrides:
getZValue in class AbstractXYZDataset
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 z-value.
Throws:
java.lang.ArrayIndexOutOfBoundsException - if series is not within the specified range.
java.lang.ArrayIndexOutOfBoundsException - if item is not within the specified range.
See Also:
getZ(int, int)

getZ

public java.lang.Number getZ(int series,
                             int item)
Returns the z-value for an item within a series.

Specified by:
getZ in interface XYZDataset
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 z-value.
Throws:
java.lang.ArrayIndexOutOfBoundsException - if series is not within the specified range.
java.lang.ArrayIndexOutOfBoundsException - if item is not within the specified range.
See Also:
getZ(int, int)

addSeries

public void addSeries(java.lang.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 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(java.lang.Comparable seriesKey)
Removes a series from the dataset, then sends a DatasetChangeEvent to all registered listeners.

Parameters:
seriesKey - the series key (null not permitted).

equals

public boolean equals(java.lang.Object obj)
Tests this DefaultXYDataset instance for equality with an arbitrary object. This method returns true if and only if:

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

hashCode

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

Overrides:
hashCode in class java.lang.Object
Returns:
A hash code.

clone

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

Specified by:
clone in interface org.jfree.util.PublicCloneable
Overrides:
clone in class AbstractDataset
Returns:
The cloned dataset.
Throws:
java.lang.CloneNotSupportedException - if there is a problem cloning the dataset (for instance, if a non-cloneable object is used for a series key).

Footer
And More


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