001    /* ===========================================================
002     * JFreeChart : a free chart library for the Java(tm) platform
003     * ===========================================================
004     *
005     * (C) Copyright 2000-2006, by Object Refinery Limited 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     * [Java is a trademark or registered trademark of Sun Microsystems, Inc. 
025     * in the United States and other countries.]
026     *
027     * --------------
028     * YInterval.java
029     * --------------
030     * (C) Copyright 2006, by Object Refinery Limited.
031     *
032     * Original Author:  David Gilbert (for Object Refinery Limited);
033     * Contributor(s):   -;
034     *
035     * $Id: YInterval.java,v 1.1.2.1 2006/10/20 15:23:22 mungady Exp $
036     *
037     * Changes
038     * -------
039     * 20-Oct-2006 : Version 1 (DG);
040     *
041     */
042    
043    package org.jfree.data.xy;
044    
045    import java.io.Serializable;
046    
047    /**
048     * A y-interval.  This class is used internally by the 
049     * {@link YIntervalDataItem} class.
050     *
051     * @since 1.0.3
052     */
053    public class YInterval implements Serializable {
054        
055        /** The y-value. */
056        private double y;
057        
058        /** The lower bound of the y-interval. */
059        private double yLow;
060        
061        /** The upper bound of the y-interval. */
062        private double yHigh;
063        
064        /** 
065         * Creates a new instance of <code>YInterval</code>.
066         *
067         * @param y  the y-value.
068         * @param yLow  the lower bound of the y-interval.
069         * @param yHigh  the upper bound of the y-interval.  
070         */
071        public YInterval(double y, double yLow, double yHigh) {
072            this.y = y;
073            this.yLow = yLow;
074            this.yHigh = yHigh;
075        }
076        
077        /**
078         * Returns the y-value.
079         *
080         * @return The y-value.
081         */
082        public double getY() {
083            return this.y;
084        }
085        
086        /**
087         * Returns the lower bound of the y-interval.
088         *
089         * @return The lower bound of the y-interval.
090         */
091        public double getYLow() {
092            return this.yLow;
093        }
094        
095        /**
096         * Returns the upper bound of the y-interval.
097         *
098         * @return The upper bound of the y-interval.
099         */
100        public double getYHigh() {
101            return this.yHigh;
102        }
103        
104        /**
105         * Tests this instance for equality with an arbitrary object.
106         *
107         * @param obj  the object (<code>null</code> permitted).
108         *
109         * @return A boolean.
110         */
111        public boolean equals(Object obj) {
112            if (obj == this) {
113                return true;
114            }
115            if (!(obj instanceof YInterval)) {
116                return false;
117            }
118            YInterval that = (YInterval) obj;
119            if (this.y != that.y) {
120                return false;
121            }
122            if (this.yLow != that.yLow) {
123                return false;
124            }
125            if (this.yHigh != that.yHigh) {
126                return false;
127            }
128            return true;
129        }
130        
131    }