Source for org.jfree.data.xy.AbstractXYDataset

   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:  * AbstractXYDataset.java
  29:  * ----------------------
  30:  * (C) Copyright 2004-2007, by Object Refinery Limited.
  31:  *
  32:  * Original Author:  David Gilbert (for Object Refinery Limited).
  33:  * Contributor(s):   -;
  34:  *
  35:  * Changes
  36:  * -------
  37:  * 05-May-2004 : Version 1 (DG);
  38:  * 15-Jul-2004 : Switched getX() with getXValue() and getY() with 
  39:  *               getYValue() (DG);
  40:  * 18-Aug-2004 : Moved from org.jfree.data --> org.jfree.data.xy (DG);
  41:  * 
  42:  */
  43: 
  44: package org.jfree.data.xy;
  45: 
  46: import org.jfree.data.DomainOrder;
  47: import org.jfree.data.general.AbstractSeriesDataset;
  48: 
  49: /**
  50:  * An base class that you can use to create new implementations of the 
  51:  * {@link XYDataset} interface.
  52:  */
  53: public abstract class AbstractXYDataset extends AbstractSeriesDataset 
  54:                                         implements XYDataset {
  55: 
  56:     /**
  57:      * Returns the order of the domain (X) values.
  58:      * 
  59:      * @return The domain order.
  60:      */
  61:     public DomainOrder getDomainOrder() {
  62:         return DomainOrder.NONE;
  63:     }
  64:     
  65:     /**
  66:      * Returns the x-value (as a double primitive) for an item within a series.
  67:      * 
  68:      * @param series  the series index (zero-based).
  69:      * @param item  the item index (zero-based).
  70:      * 
  71:      * @return The value.
  72:      */
  73:     public double getXValue(int series, int item) {
  74:         double result = Double.NaN;
  75:         Number x = getX(series, item);
  76:         if (x != null) {
  77:             result = x.doubleValue();   
  78:         }
  79:         return result;   
  80:     }
  81: 
  82:     /**
  83:      * Returns the y-value (as a double primitive) for an item within a series.
  84:      * 
  85:      * @param series  the series index (zero-based).
  86:      * @param item  the item index (zero-based).
  87:      * 
  88:      * @return The value.
  89:      */
  90:     public double getYValue(int series, int item) {
  91:         double result = Double.NaN;
  92:         Number y = getY(series, item);
  93:         if (y != null) {
  94:             result = y.doubleValue();   
  95:         }
  96:         return result;   
  97:     }
  98: 
  99: }