1 /* ===========================================================
2 * JFreeChart : a free chart library for the Java(tm) platform
3 * ===========================================================
4 *
5 * (C) Copyright 2000-2007, by Object Refinery Limited and Contributors.
6 *
7 * Project Info: http://www.jfree.org/jfreechart/index.html
8 *
9 * This library is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU Lesser General Public License as published by
11 * the Free Software Foundation; either version 2.1 of the License, or
12 * (at your option) any later version.
13 *
14 * This library is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
17 * License for more details.
18 *
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
22 * USA.
23 *
24 * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
25 * in the United States and other countries.]
26 *
27 * --------------
28 * XYDataset.java
29 * --------------
30 * (C) Copyright 2000-2007, by Object Refinery Limited.
31 *
32 * Original Author: David Gilbert (for Object Refinery Limited);
33 * Contributor(s): -;
34 *
35 * Changes (from 18-Sep-2001)
36 * --------------------------
37 * 18-Sep-2001 : Added standard header and fixed DOS encoding problem (DG);
38 * 15-Oct-2001 : Moved to a new package (com.jrefinery.data.*) (DG);
39 * 22-Oct-2001 : Renamed DataSource.java --> Dataset.java etc. (DG);
40 * 17-Nov-2001 : Now extends SeriesDataset (DG);
41 * 15-Jul-2004 : Switched getX() with getXValue() and getY() with
42 * getYValue() (DG);
43 * 29-Jul-2004 : Added getDomainOrder() method (DG);
44 * 18-Aug-2004 : Moved from org.jfree.data --> org.jfree.data.xy (DG);
45 *
46 */
47
48 package org.jfree.data.xy;
49
50 import org.jfree.data.DomainOrder;
51 import org.jfree.data.general.SeriesDataset;
52
53 /**
54 * An interface through which data in the form of (x, y) items can be accessed.
55 */
56 public interface XYDataset extends SeriesDataset {
57
58 /**
59 * Returns the order of the domain (or X) values returned by the dataset.
60 *
61 * @return The order (never <code>null</code>).
62 */
63 public DomainOrder getDomainOrder();
64
65 /**
66 * Returns the number of items in a series.
67 * <br><br>
68 * It is recommended that classes that implement this method should throw
69 * an <code>IllegalArgumentException</code> if the <code>series</code>
70 * argument is outside the specified range.
71 *
72 * @param series the series index (in the range <code>0</code> to
73 * <code>getSeriesCount() - 1</code>).
74 *
75 * @return The item count.
76 */
77 public int getItemCount(int series);
78
79 /**
80 * Returns the x-value for an item within a series. The x-values may or
81 * may not be returned in ascending order, that is up to the class
82 * implementing the interface.
83 *
84 * @param series the series index (in the range <code>0</code> to
85 * <code>getSeriesCount() - 1</code>).
86 * @param item the item index (in the range <code>0</code> to
87 * <code>getItemCount(series)</code>).
88 *
89 * @return The x-value (never <code>null</code>).
90 */
91 public Number getX(int series, int item);
92
93 /**
94 * Returns the x-value for an item within a series.
95 *
96 * @param series the series index (in the range <code>0</code> to
97 * <code>getSeriesCount() - 1</code>).
98 * @param item the item index (in the range <code>0</code> to
99 * <code>getItemCount(series)</code>).
100 *
101 * @return The x-value.
102 */
103 public double getXValue(int series, int item);
104
105 /**
106 * Returns the y-value for an item within a series.
107 *
108 * @param series the series index (in the range <code>0</code> to
109 * <code>getSeriesCount() - 1</code>).
110 * @param item the item index (in the range <code>0</code> to
111 * <code>getItemCount(series)</code>).
112 *
113 * @return The y-value (possibly <code>null</code>).
114 */
115 public Number getY(int series, int item);
116
117 /**
118 * Returns the y-value (as a double primitive) for an item within a series.
119 *
120 * @param series the series index (in the range <code>0</code> to
121 * <code>getSeriesCount() - 1</code>).
122 * @param item the item index (in the range <code>0</code> to
123 * <code>getItemCount(series)</code>).
124 *
125 * @return The y-value.
126 */
127 public double getYValue(int series, int item);
128
129 }