Header
And More


org.jfree.data.xy
Class DefaultIntervalXYDataset

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

public class DefaultIntervalXYDataset
extends AbstractIntervalXYDataset
implements org.jfree.util.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 the IntervalXYDataset interface is provided by the XYIntervalSeriesCollection class.

Since:
1.0.3
See Also:
Serialized Form

Constructor Summary
DefaultIntervalXYDataset()
          Creates a new DefaultIntervalXYDataset 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()
          Returns a clone of this dataset.
 boolean equals(java.lang.Object obj)
          Tests this DefaultIntervalXYDataset instance for equality with an arbitrary object.
 java.lang.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.
 java.lang.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.
 java.lang.Comparable getSeriesKey(int series)
          Returns the key for a series.
 java.lang.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.
 java.lang.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.
 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.
 int hashCode()
          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, 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.xy.XYDataset
getDomainOrder
 
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

DefaultIntervalXYDataset

public DefaultIntervalXYDataset()
Creates a new DefaultIntervalXYDataset 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.

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)

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)

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 class 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.
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:
getStartX(int, int)

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 class 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.
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:
getEndX(int, int)

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 class 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.
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:
getStartY(int, int)

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 class 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.
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:
getEndY(int, int)

getEndX

public java.lang.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.
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:
getEndXValue(int, int)

getEndY

public java.lang.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.
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:
getEndYValue(int, int)

getStartX

public java.lang.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.
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:
getStartXValue(int, int)

getStartY

public java.lang.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.
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:
getStartYValue(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)

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:
getYValue(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 6, containing six arrays of equal length, the first containing the x-values and the second containing the y-values).

equals

public boolean equals(java.lang.Object obj)
Tests this DefaultIntervalXYDataset 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
Returns a clone of this dataset.

Specified by:
clone in interface org.jfree.util.PublicCloneable
Overrides:
clone in class AbstractDataset
Returns:
A clone.
Throws:
java.lang.CloneNotSupportedException - if the dataset contains a series with a key that cannot be cloned.

Footer
And More


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