Source for org.jfree.data.xy.XYInterval

   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:  * XYInterval.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:  * An  xy-interval.  This class is used internally by the 
  47:  * {@link XYIntervalDataItem} class.
  48:  *
  49:  * @since 1.0.3
  50:  */
  51: public class XYInterval implements Serializable {
  52:     
  53:     /** The lower bound of the x-interval. */
  54:     private double xLow;
  55:     
  56:     /** The upper bound of the y-interval. */
  57:     private double xHigh;
  58:     
  59:     /** The y-value. */
  60:     private double y;
  61:     
  62:     /** The lower bound of the y-interval. */
  63:     private double yLow;
  64:     
  65:     /** The upper bound of the y-interval. */
  66:     private double yHigh;
  67:     
  68:     /** 
  69:      * Creates a new instance of <code>XYInterval</code>.
  70:      *
  71:      * @param xLow  the lower bound of the x-interval.
  72:      * @param xHigh  the upper bound of the y-interval.
  73:      * @param y  the y-value.
  74:      * @param yLow  the lower bound of the y-interval.
  75:      * @param yHigh  the upper bound of the y-interval.  
  76:      */
  77:     public XYInterval(double xLow, double xHigh, double y, double yLow, 
  78:             double yHigh) {
  79:         this.xLow = xLow;
  80:         this.xHigh = xHigh;
  81:         this.y = y;
  82:         this.yLow = yLow;
  83:         this.yHigh = yHigh;
  84:     }
  85:     
  86:     /**
  87:      * Returns the lower bound of the x-interval.
  88:      *
  89:      * @return The lower bound of the x-interval.
  90:      */
  91:     public double getXLow() {
  92:         return this.xLow;
  93:     }
  94:     
  95:     /**
  96:      * Returns the upper bound of the x-interval.
  97:      *
  98:      * @return The upper bound of the x-interval.
  99:      */
 100:     public double getXHigh() {
 101:         return this.xHigh;
 102:     }
 103: 
 104:     /**
 105:      * Returns the y-value.
 106:      *
 107:      * @return The y-value.
 108:      */
 109:     public double getY() {
 110:         return this.y;
 111:     }
 112:     
 113:     /**
 114:      * Returns the lower bound of the y-interval.
 115:      *
 116:      * @return The lower bound of the y-interval.
 117:      */
 118:     public double getYLow() {
 119:         return this.yLow;
 120:     }
 121:     
 122:     /**
 123:      * Returns the upper bound of the y-interval.
 124:      *
 125:      * @return The upper bound of the y-interval.
 126:      */
 127:     public double getYHigh() {
 128:         return this.yHigh;
 129:     }
 130:     
 131:     /**
 132:      * Tests this instance for equality with an arbitrary object.
 133:      *
 134:      * @param obj  the object (<code>null</code> permitted).
 135:      *
 136:      * @return A boolean.
 137:      */
 138:     public boolean equals(Object obj) {
 139:         if (obj == this) {
 140:             return true;
 141:         }
 142:         if (!(obj instanceof XYInterval)) {
 143:             return false;
 144:         }
 145:         XYInterval that = (XYInterval) obj;
 146:         if (this.xLow != that.xLow) {
 147:             return false;
 148:         }
 149:         if (this.xHigh != that.xHigh) {
 150:             return false;
 151:         }
 152:         if (this.y != that.y) {
 153:             return false;
 154:         }
 155:         if (this.yLow != that.yLow) {
 156:             return false;
 157:         }
 158:         if (this.yHigh != that.yHigh) {
 159:             return false;
 160:         }
 161:         return true;
 162:     }
 163:     
 164: }