Source for org.jfree.data.xy.AbstractIntervalXYDataset

   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:  * AbstractIntervalXYDataset.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 getStartX() and getStartXValue() methods and 
  39:  *               others (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: 
  47: /**
  48:  * An base class that you can use to create new implementations of the 
  49:  * {@link IntervalXYDataset} interface.
  50:  */
  51: public abstract class AbstractIntervalXYDataset extends AbstractXYDataset 
  52:                                                 implements IntervalXYDataset {
  53: 
  54:     /**
  55:      * Returns the start x-value (as a double primitive) for an item within a 
  56:      * series.
  57:      * 
  58:      * @param series  the series index (zero-based).
  59:      * @param item  the item index (zero-based).
  60:      * 
  61:      * @return The value.
  62:      */
  63:     public double getStartXValue(int series, int item) {
  64:         double result = Double.NaN;
  65:         Number x = getStartX(series, item);
  66:         if (x != null) {
  67:             result = x.doubleValue();   
  68:         }
  69:         return result;   
  70:     }
  71: 
  72:     /**
  73:      * Returns the end x-value (as a double primitive) for an item within a 
  74:      * series.
  75:      * 
  76:      * @param series  the series index (zero-based).
  77:      * @param item  the item index (zero-based).
  78:      * 
  79:      * @return The value.
  80:      */
  81:     public double getEndXValue(int series, int item) {
  82:         double result = Double.NaN;
  83:         Number x = getEndX(series, item);
  84:         if (x != null) {
  85:             result = x.doubleValue();   
  86:         }
  87:         return result;   
  88:     }
  89: 
  90:     /**
  91:      * Returns the start y-value (as a double primitive) for an item within a 
  92:      * series.
  93:      * 
  94:      * @param series  the series index (zero-based).
  95:      * @param item  the item index (zero-based).
  96:      * 
  97:      * @return The value.
  98:      */
  99:     public double getStartYValue(int series, int item) {
 100:         double result = Double.NaN;
 101:         Number y = getStartY(series, item);
 102:         if (y != null) {
 103:             result = y.doubleValue();   
 104:         }
 105:         return result;   
 106:     }
 107: 
 108:     /**
 109:      * Returns the end y-value (as a double primitive) for an item within a 
 110:      * series.
 111:      * 
 112:      * @param series  the series (zero-based index).
 113:      * @param item  the item (zero-based index).
 114:      * 
 115:      * @return The value.
 116:      */
 117:     public double getEndYValue(int series, int item) {
 118:         double result = Double.NaN;
 119:         Number y = getEndY(series, item);
 120:         if (y != null) {
 121:             result = y.doubleValue();   
 122:         }
 123:         return result;   
 124:     }
 125: 
 126: }