001/* ===========================================================
002 * JFreeChart : a free chart library for the Java(tm) platform
003 * ===========================================================
004 *
005 * (C) Copyright 2000-present, by David Gilbert and Contributors.
006 *
007 * Project Info:  http://www.jfree.org/jfreechart/index.html
008 *
009 * This library is free software; you can redistribute it and/or modify it
010 * under the terms of the GNU Lesser General Public License as published by
011 * the Free Software Foundation; either version 2.1 of the License, or
012 * (at your option) any later version.
013 *
014 * This library is distributed in the hope that it will be useful, but
015 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
016 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
017 * License for more details.
018 *
019 * You should have received a copy of the GNU Lesser General Public
020 * License along with this library; if not, write to the Free Software
021 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
022 * USA.
023 *
024 * [Oracle and Java are registered trademarks of Oracle and/or its affiliates. 
025 * Other names may be trademarks of their respective owners.]
026 *
027 * -------------------
028 * HeatMapDataset.java
029 * -------------------
030 * (C) Copyright 2009-present, by David Gilbert.
031 *
032 * Original Author:  David Gilbert;
033 * Contributor(s):   -;
034 *
035 */
036
037package org.jfree.data.general;
038
039/**
040 * A dataset that represents a rectangular grid of (x, y, z) values.  The x
041 * and y values appear at regular intervals in the dataset, while the z-values
042 * can take any value (including {@code null} for unknown values).
043 */
044public interface HeatMapDataset {
045
046    /**
047     * Returns the number of x values across the width of the dataset.  The
048     * values are evenly spaced between {@link #getMinimumXValue()} and
049     * {@link #getMaximumXValue()}.
050     * 
051     * @return The number of x-values (always > 0).
052     */
053    int getXSampleCount();
054
055    /**
056     * Returns the number of y values (or samples) for the dataset.  The
057     * values are evenly spaced between {@link #getMinimumYValue()} and
058     * {@link #getMaximumYValue()}.
059     *
060     * @return The number of y-values (always > 0).
061     */
062    int getYSampleCount();
063
064    /**
065     * Returns the lowest x-value represented in this dataset.  A requirement
066     * of this interface is that this method must never return infinite or
067     * Double.NAN values.
068     *
069     * @return The lowest x-value represented in this dataset.
070     */
071    double getMinimumXValue();
072
073    /**
074     * Returns the highest x-value represented in this dataset.  A requirement
075     * of this interface is that this method must never return infinite or
076     * Double.NAN values.
077     *
078     * @return The highest x-value represented in this dataset.
079     */
080    double getMaximumXValue();
081
082    /**
083     * Returns the lowest y-value represented in this dataset.  A requirement
084     * of this interface is that this method must never return infinite or
085     * Double.NAN values.
086     *
087     * @return The lowest y-value represented in this dataset.
088     */
089    double getMinimumYValue();
090
091    /**
092     * Returns the highest y-value represented in this dataset.  A requirement
093     * of this interface is that this method must never return infinite or
094     * Double.NAN values.
095     *
096     * @return The highest y-value represented in this dataset.
097     */
098    double getMaximumYValue();
099
100    /**
101     * A convenience method that returns the x-value for the given index.
102     * 
103     * @param xIndex  the xIndex.
104     * 
105     * @return The x-value.
106     */
107    double getXValue(int xIndex);
108
109    /**
110     * A convenience method that returns the y-value for the given index.
111     * 
112     * @param yIndex  the yIndex.
113     * 
114     * @return The y-value.
115     */
116    double getYValue(int yIndex);
117
118    /**
119     * Returns the z-value at the specified sample position in the dataset.
120     * For a missing or unknown value, this method should return Double.NAN.
121     *
122     * @param xIndex  the position of the x sample in the dataset.
123     * @param yIndex  the position of the y sample in the dataset.
124     *
125     * @return The z-value.
126     */
127    double getZValue(int xIndex, int yIndex);
128
129    /**
130     * Returns the z-value at the specified sample position in the dataset.
131     * This method can return {@code null} to indicate a missing/unknown
132     * value.
133     * <br><br>
134     * Bear in mind that the class implementing this interface may
135     * store its data using primitives rather than objects, so calling this
136     * method may require a new {@code Number} object to be allocated...
137     * for this reason, it is generally preferable to use the
138     * {@link #getZValue(int, int)} method unless you *know* that the dataset
139     * implementation stores the z-values using objects.
140     *
141     * @param xIndex  the position of the x sample in the dataset.
142     * @param yIndex  the position of the y sample in the dataset.
143     *
144     * @return The z-value (possibly {@code null}).
145     */
146    Number getZ(int xIndex, int yIndex);
147
148}