001/* =========================================================== 002 * JFreeChart : a free chart library for the Java(tm) platform 003 * =========================================================== 004 * 005 * (C) Copyright 2000-2020, by Object Refinery Limited 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-2016, by Object Refinery Limited. 031 * 032 * Original Author: David Gilbert (for Object Refinery Limited); 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 * 044 * @since 1.0.13 045 */ 046public interface HeatMapDataset { 047 048 /** 049 * Returns the number of x values across the width of the dataset. The 050 * values are evenly spaced between {@link #getMinimumXValue()} and 051 * {@link #getMaximumXValue()}. 052 * 053 * @return The number of x-values (always > 0). 054 */ 055 public int getXSampleCount(); 056 057 /** 058 * Returns the number of y values (or samples) for the dataset. The 059 * values are evenly spaced between {@link #getMinimumYValue()} and 060 * {@link #getMaximumYValue()}. 061 * 062 * @return The number of y-values (always > 0). 063 */ 064 public int getYSampleCount(); 065 066 /** 067 * Returns the lowest x-value represented in this dataset. A requirement 068 * of this interface is that this method must never return infinite or 069 * Double.NAN values. 070 * 071 * @return The lowest x-value represented in this dataset. 072 */ 073 public double getMinimumXValue(); 074 075 /** 076 * Returns the highest x-value represented in this dataset. A requirement 077 * of this interface is that this method must never return infinite or 078 * Double.NAN values. 079 * 080 * @return The highest x-value represented in this dataset. 081 */ 082 public double getMaximumXValue(); 083 084 /** 085 * Returns the lowest y-value represented in this dataset. A requirement 086 * of this interface is that this method must never return infinite or 087 * Double.NAN values. 088 * 089 * @return The lowest y-value represented in this dataset. 090 */ 091 public double getMinimumYValue(); 092 093 /** 094 * Returns the highest y-value represented in this dataset. A requirement 095 * of this interface is that this method must never return infinite or 096 * Double.NAN values. 097 * 098 * @return The highest y-value represented in this dataset. 099 */ 100 public double getMaximumYValue(); 101 102 /** 103 * A convenience method that returns the x-value for the given index. 104 * 105 * @param xIndex the xIndex. 106 * 107 * @return The x-value. 108 */ 109 public double getXValue(int xIndex); 110 111 /** 112 * A convenience method that returns the y-value for the given index. 113 * 114 * @param yIndex the yIndex. 115 * 116 * @return The y-value. 117 */ 118 public double getYValue(int yIndex); 119 120 /** 121 * Returns the z-value at the specified sample position in the dataset. 122 * For a missing or unknown value, this method should return Double.NAN. 123 * 124 * @param xIndex the position of the x sample in the dataset. 125 * @param yIndex the position of the y sample in the dataset. 126 * 127 * @return The z-value. 128 */ 129 public double getZValue(int xIndex, int yIndex); 130 131 /** 132 * Returns the z-value at the specified sample position in the dataset. 133 * This method can return {@code null} to indicate a missing/unknown 134 * value. 135 * <br><br> 136 * Bear in mind that the class implementing this interface may 137 * store its data using primitives rather than objects, so calling this 138 * method may require a new {@code Number} object to be allocated... 139 * for this reason, it is generally preferable to use the 140 * {@link #getZValue(int, int)} method unless you *know* that the dataset 141 * implementation stores the z-values using objects. 142 * 143 * @param xIndex the position of the x sample in the dataset. 144 * @param yIndex the position of the y sample in the dataset. 145 * 146 * @return The z-value (possibly {@code null}). 147 */ 148 public Number getZ(int xIndex, int yIndex); 149 150}