001/* ===========================================================
002 * JFreeChart : a free chart library for the Java(tm) platform
003 * ===========================================================
004 *
005 * (C) Copyright 2000-2013, 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 * XYDataset.java
029 * --------------
030 * (C) Copyright 2000-2008, by Object Refinery Limited.
031 *
032 * Original Author:  David Gilbert (for Object Refinery Limited);
033 * Contributor(s):   -;
034 *
035 * Changes (from 18-Sep-2001)
036 * --------------------------
037 * 18-Sep-2001 : Added standard header and fixed DOS encoding problem (DG);
038 * 15-Oct-2001 : Moved to a new package (com.jrefinery.data.*) (DG);
039 * 22-Oct-2001 : Renamed DataSource.java --> Dataset.java etc. (DG);
040 * 17-Nov-2001 : Now extends SeriesDataset (DG);
041 * 15-Jul-2004 : Switched getX() with getXValue() and getY() with
042 *               getYValue() (DG);
043 * 29-Jul-2004 : Added getDomainOrder() method (DG);
044 * 18-Aug-2004 : Moved from org.jfree.data --> org.jfree.data.xy (DG);
045 *
046 */
047
048package org.jfree.data.xy;
049
050import org.jfree.data.DomainOrder;
051import org.jfree.data.general.SeriesDataset;
052
053/**
054 * An interface through which data in the form of (x, y) items can be accessed.
055 */
056public interface XYDataset extends SeriesDataset {
057
058    /**
059     * Returns the order of the domain (or X) values returned by the dataset.
060     *
061     * @return The order (never <code>null</code>).
062     */
063    public DomainOrder getDomainOrder();
064
065    /**
066     * Returns the number of items in a series.
067     * <br><br>
068     * It is recommended that classes that implement this method should throw
069     * an <code>IllegalArgumentException</code> if the <code>series</code>
070     * argument is outside the specified range.
071     *
072     * @param series  the series index (in the range <code>0</code> to
073     *     <code>getSeriesCount() - 1</code>).
074     *
075     * @return The item count.
076     */
077    public int getItemCount(int series);
078
079    /**
080     * Returns the x-value for an item within a series.  The x-values may or
081     * may not be returned in ascending order, that is up to the class
082     * implementing the interface.
083     *
084     * @param series  the series index (in the range <code>0</code> to
085     *     <code>getSeriesCount() - 1</code>).
086     * @param item  the item index (in the range <code>0</code> to
087     *     <code>getItemCount(series)</code>).
088     *
089     * @return The x-value (never <code>null</code>).
090     */
091    public Number getX(int series, int item);
092
093    /**
094     * Returns the x-value for an item within a series.
095     *
096     * @param series  the series index (in the range <code>0</code> to
097     *     <code>getSeriesCount() - 1</code>).
098     * @param item  the item index (in the range <code>0</code> to
099     *     <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}