Source for org.jfree.data.xy.YInterval

   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:  * YInterval.java
  29:  * --------------
  30:  * (C) Copyright 2006, 2007, by Object Refinery Limited.
  31:  *
  32:  * Original Author:  David Gilbert (for Object Refinery Limited);
  33:  * Contributor(s):   -;
  34:  *
  35:  * Changes
  36:  * -------
  37:  * 20-Oct-2006 : Version 1 (DG);
  38:  *
  39:  */
  40: 
  41: package org.jfree.data.xy;
  42: 
  43: import java.io.Serializable;
  44: 
  45: /**
  46:  * A y-interval.  This class is used internally by the 
  47:  * {@link YIntervalDataItem} class.
  48:  *
  49:  * @since 1.0.3
  50:  */
  51: public class YInterval implements Serializable {
  52:     
  53:     /** The y-value. */
  54:     private double y;
  55:     
  56:     /** The lower bound of the y-interval. */
  57:     private double yLow;
  58:     
  59:     /** The upper bound of the y-interval. */
  60:     private double yHigh;
  61:     
  62:     /** 
  63:      * Creates a new instance of <code>YInterval</code>.
  64:      *
  65:      * @param y  the y-value.
  66:      * @param yLow  the lower bound of the y-interval.
  67:      * @param yHigh  the upper bound of the y-interval.  
  68:      */
  69:     public YInterval(double y, double yLow, double yHigh) {
  70:         this.y = y;
  71:         this.yLow = yLow;
  72:         this.yHigh = yHigh;
  73:     }
  74:     
  75:     /**
  76:      * Returns the y-value.
  77:      *
  78:      * @return The y-value.
  79:      */
  80:     public double getY() {
  81:         return this.y;
  82:     }
  83:     
  84:     /**
  85:      * Returns the lower bound of the y-interval.
  86:      *
  87:      * @return The lower bound of the y-interval.
  88:      */
  89:     public double getYLow() {
  90:         return this.yLow;
  91:     }
  92:     
  93:     /**
  94:      * Returns the upper bound of the y-interval.
  95:      *
  96:      * @return The upper bound of the y-interval.
  97:      */
  98:     public double getYHigh() {
  99:         return this.yHigh;
 100:     }
 101:     
 102:     /**
 103:      * Tests this instance for equality with an arbitrary object.
 104:      *
 105:      * @param obj  the object (<code>null</code> permitted).
 106:      *
 107:      * @return A boolean.
 108:      */
 109:     public boolean equals(Object obj) {
 110:         if (obj == this) {
 111:             return true;
 112:         }
 113:         if (!(obj instanceof YInterval)) {
 114:             return false;
 115:         }
 116:         YInterval that = (YInterval) obj;
 117:         if (this.y != that.y) {
 118:             return false;
 119:         }
 120:         if (this.yLow != that.yLow) {
 121:             return false;
 122:         }
 123:         if (this.yHigh != that.yHigh) {
 124:             return false;
 125:         }
 126:         return true;
 127:     }
 128:     
 129: }