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 * XYDataset.java
029 * --------------
030 * (C) Copyright 2000-present, by David Gilbert.
031 *
032 * Original Author:  David Gilbert;
033 * Contributor(s):   -;
034 *
035 */
036
037package org.jfree.data.xy;
038
039import org.jfree.data.DomainOrder;
040import org.jfree.data.general.SeriesDataset;
041
042/**
043 * An interface through which data in the form of (x, y) items can be accessed.
044 */
045public interface XYDataset extends SeriesDataset {
046
047    /**
048     * Returns the order of the domain (or X) values returned by the dataset.
049     *
050     * @return The order (never {@code null}).
051     */
052    DomainOrder getDomainOrder();
053
054    /**
055     * Returns the number of items in a series.
056     * <br><br>
057     * It is recommended that classes that implement this method should throw
058     * an {@code IllegalArgumentException} if the {@code series}
059     * argument is outside the specified range.
060     *
061     * @param series  the series index (in the range {@code 0} to
062     *     {@code getSeriesCount() - 1}).
063     *
064     * @return The item count.
065     */
066    int getItemCount(int series);
067
068    /**
069     * Returns the x-value for an item within a series.  The x-values may or
070     * may not be returned in ascending order, that is up to the class
071     * implementing the interface.
072     *
073     * @param series  the series index (in the range {@code 0} to
074     *     {@code getSeriesCount() - 1}).
075     * @param item  the item index (in the range {@code 0} to
076     *     {@code getItemCount(series)}).
077     *
078     * @return The x-value (never {@code null}).
079     */
080    Number getX(int series, int item);
081
082    /**
083     * Returns the x-value for an item within a series.
084     *
085     * @param series  the series index (in the range {@code 0} to
086     *     {@code getSeriesCount() - 1}).
087     * @param item  the item index (in the range {@code 0} to
088     *     {@code getItemCount(series)}).
089     *
090     * @return The x-value.
091     */
092    double getXValue(int series, int item);
093
094    /**
095     * Returns the y-value for an item within a series.
096     *
097     * @param series  the series index (in the range {@code 0} to
098     *     {@code getSeriesCount() - 1}).
099     * @param item  the item index (in the range {@code 0} to
100     *     {@code getItemCount(series)}).
101     *
102     * @return The y-value (possibly {@code null}).
103     */
104    Number getY(int series, int item);
105
106    /**
107     * Returns the y-value (as a double primitive) for an item within a series.
108     *
109     * @param series  the series index (in the range {@code 0} to
110     *     {@code getSeriesCount() - 1}).
111     * @param item  the item index (in the range {@code 0} to
112     *     {@code getItemCount(series)}).
113     *
114     * @return The y-value.
115     */
116    double getYValue(int series, int item);
117
118}