001 /* =========================================================== 002 * JFreeChart : a free chart library for the Java(tm) platform 003 * =========================================================== 004 * 005 * (C) Copyright 2000-2006, 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 * [Java is a trademark or registered trademark of Sun Microsystems, Inc. 025 * in the United States and other countries.] 026 * 027 * -------------- 028 * XYDataset.java 029 * -------------- 030 * (C) Copyright 2000-2006, by Object Refinery Limited. 031 * 032 * Original Author: David Gilbert (for Object Refinery Limited); 033 * Contributor(s): -; 034 * 035 * $Id: XYDataset.java,v 1.2.2.2 2006/08/03 16:22:40 mungady Exp $ 036 * 037 * Changes (from 18-Sep-2001) 038 * -------------------------- 039 * 18-Sep-2001 : Added standard header and fixed DOS encoding problem (DG); 040 * 15-Oct-2001 : Moved to a new package (com.jrefinery.data.*) (DG); 041 * 22-Oct-2001 : Renamed DataSource.java --> Dataset.java etc. (DG); 042 * 17-Nov-2001 : Now extends SeriesDataset (DG); 043 * 15-Jul-2004 : Switched getX() with getXValue() and getY() with 044 * getYValue() (DG); 045 * 29-Jul-2004 : Added getDomainOrder() method (DG); 046 * 18-Aug-2004 : Moved from org.jfree.data --> org.jfree.data.xy (DG); 047 * 048 */ 049 050 package org.jfree.data.xy; 051 052 import org.jfree.data.DomainOrder; 053 import org.jfree.data.general.SeriesDataset; 054 055 /** 056 * An interface through which data in the form of (x, y) items can be accessed. 057 */ 058 public interface XYDataset extends SeriesDataset { 059 060 /** 061 * Returns the order of the domain (or X) values returned by the dataset. 062 * 063 * @return The order (never <code>null</code>). 064 */ 065 public DomainOrder getDomainOrder(); 066 067 /** 068 * Returns the number of items in a series. 069 * <br><br> 070 * It is recommended that classes that implement this method should throw 071 * an <code>IllegalArgumentException</code> if the <code>series</code> 072 * argument is outside the specified range. 073 * 074 * @param series the series index (in the range <code>0</code> to 075 * <code>getSeriesCount() - 1</code>). 076 * 077 * @return The item count. 078 */ 079 public int getItemCount(int series); 080 081 /** 082 * Returns the x-value for an item within a series. The x-values may or 083 * may not be returned in ascending order, that is up to the class 084 * implementing the interface. 085 * 086 * @param series the series index (in the range <code>0</code> to 087 * <code>getSeriesCount() - 1</code>). 088 * @param item the item index (in the range <code>0</code> to 089 * <code>getItemCount(series)</code>). 090 * 091 * @return The x-value (never <code>null</code>). 092 */ 093 public Number getX(int series, int item); 094 095 /** 096 * Returns the x-value for an item within a series. 097 * 098 * @param series the series index (in the range <code>0</code> to 099 * <code>getSeriesCount() - 1</code>). 100 * @param item the item index (in the range <code>0</code> to 101 * <code>getItemCount(series)</code>). 102 * 103 * @return The x-value. 104 */ 105 public double getXValue(int series, int item); 106 107 /** 108 * Returns the y-value for an item within a series. 109 * 110 * @param series the series index (in the range <code>0</code> to 111 * <code>getSeriesCount() - 1</code>). 112 * @param item the item index (in the range <code>0</code> to 113 * <code>getItemCount(series)</code>). 114 * 115 * @return The y-value (possibly <code>null</code>). 116 */ 117 public Number getY(int series, int item); 118 119 /** 120 * Returns the y-value (as a double primitive) for an item within a series. 121 * 122 * @param series the series index (in the range <code>0</code> to 123 * <code>getSeriesCount() - 1</code>). 124 * @param item the item index (in the range <code>0</code> to 125 * <code>getItemCount(series)</code>). 126 * 127 * @return The y-value. 128 */ 129 public double getYValue(int series, int item); 130 131 }