org.jfree.data.general

Class DefaultHeatMapDataset

public class DefaultHeatMapDataset extends AbstractDataset implements HeatMapDataset, Cloneable, PublicCloneable, Serializable

A default implementation of the HeatMapDataset interface.

Since: 1.0.13

Constructor Summary
DefaultHeatMapDataset(int xSamples, int ySamples, double minX, double maxX, double minY, double maxY)
Creates a new dataset where all the z-values are initially 0.
Method Summary
Objectclone()
Returns an independent copy of this dataset.
booleanequals(Object obj)
Tests this dataset for equality with an arbitrary object.
doublegetMaximumXValue()
Returns the highest x-value represented in this dataset.
doublegetMaximumYValue()
Returns the highest y-value represented in this dataset.
doublegetMinimumXValue()
Returns the lowest x-value represented in this dataset.
doublegetMinimumYValue()
Returns the lowest y-value represented in this dataset.
intgetXSampleCount()
Returns the number of x values across the width of the dataset.
doublegetXValue(int xIndex)
A convenience method that returns the x-value for the given index.
intgetYSampleCount()
Returns the number of y values (or samples) for the dataset.
doublegetYValue(int yIndex)
A convenience method that returns the y-value for the given index.
NumbergetZ(int xIndex, int yIndex)
Returns the z-value at the specified sample position in the dataset.
doublegetZValue(int xIndex, int yIndex)
Returns the z-value at the specified sample position in the dataset.
voidsetZValue(int xIndex, int yIndex, double z)
Updates a z-value in the dataset and sends a DatasetChangeEvent to all registered listeners.
voidsetZValue(int xIndex, int yIndex, double z, boolean notify)
Updates a z-value in the dataset and, if requested, sends a DatasetChangeEvent to all registered listeners.

Constructor Detail

DefaultHeatMapDataset

public DefaultHeatMapDataset(int xSamples, int ySamples, double minX, double maxX, double minY, double maxY)
Creates a new dataset where all the z-values are initially 0. This is a fixed size array of z-values.

Parameters: xSamples the number of x-values. ySamples the number of y-values minX the minimum x-value in the dataset. maxX the maximum x-value in the dataset. minY the minimum y-value in the dataset. maxY the maximum y-value in the dataset.

Method Detail

clone

public Object clone()
Returns an independent copy of this dataset.

Returns: A clone.

Throws: java.lang.CloneNotSupportedException

equals

public boolean equals(Object obj)
Tests this dataset for equality with an arbitrary object.

Parameters: obj the object (null permitted).

Returns: A boolean.

getMaximumXValue

public double getMaximumXValue()
Returns the highest x-value represented in this dataset. A requirement of this interface is that this method must never return infinite or Double.NAN values.

Returns: The highest x-value represented in this dataset.

getMaximumYValue

public double getMaximumYValue()
Returns the highest y-value represented in this dataset. A requirement of this interface is that this method must never return infinite or Double.NAN values.

Returns: The highest y-value represented in this dataset.

getMinimumXValue

public double getMinimumXValue()
Returns the lowest x-value represented in this dataset. A requirement of this interface is that this method must never return infinite or Double.NAN values.

Returns: The lowest x-value represented in this dataset.

getMinimumYValue

public double getMinimumYValue()
Returns the lowest y-value represented in this dataset. A requirement of this interface is that this method must never return infinite or Double.NAN values.

Returns: The lowest y-value represented in this dataset.

getXSampleCount

public int getXSampleCount()
Returns the number of x values across the width of the dataset. The values are evenly spaced between getMinimumXValue and getMaximumXValue.

Returns: The number of x-values (always > 0).

getXValue

public double getXValue(int xIndex)
A convenience method that returns the x-value for the given index.

Parameters: xIndex the xIndex.

Returns: The x-value.

getYSampleCount

public int getYSampleCount()
Returns the number of y values (or samples) for the dataset. The values are evenly spaced between getMinimumYValue and getMaximumYValue.

Returns: The number of y-values (always > 0).

getYValue

public double getYValue(int yIndex)
A convenience method that returns the y-value for the given index.

Parameters: yIndex the yIndex.

Returns: The y-value.

getZ

public Number getZ(int xIndex, int yIndex)
Returns the z-value at the specified sample position in the dataset. In this implementation, where the underlying values are stored in an array of double primitives, you should avoid using this method and use DefaultHeatMapDataset instead.

Parameters: xIndex the position of the x sample in the dataset. yIndex the position of the y sample in the dataset.

Returns: The z-value.

getZValue

public double getZValue(int xIndex, int yIndex)
Returns the z-value at the specified sample position in the dataset. For a missing or unknown value, this method should return Double.NAN.

Parameters: xIndex the position of the x sample in the dataset. yIndex the position of the y sample in the dataset.

Returns: The z-value.

setZValue

public void setZValue(int xIndex, int yIndex, double z)
Updates a z-value in the dataset and sends a DatasetChangeEvent to all registered listeners.

Parameters: xIndex the x-index. yIndex the y-index. z the new z-value.

setZValue

public void setZValue(int xIndex, int yIndex, double z, boolean notify)
Updates a z-value in the dataset and, if requested, sends a DatasetChangeEvent to all registered listeners.

Parameters: xIndex the x-index. yIndex the y-index. z the new z-value. notify notify listeners?

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