    001    /* ===========================================================
    002     * JFreeChart : a free chart library for the Java(tm) platform
    003     * ===========================================================
    004     *
    005     * (C) Copyright 2000-2011, 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     * [Oracle and Java are registered trademarks of Oracle and/or its affiliates.
    025     * Other names may be trademarks of their respective owners.]
    026     *
    027     * --------------
    028     * YInterval.java
    029     * --------------
    030     * (C) Copyright 2006-2008, by Object Refinery Limited.
    031     *
    032     * Original Author:  David Gilbert (for Object Refinery Limited);
    033     * Contributor(s):   -;
    034     *
    035     * Changes
    036     * -------
    037     * 20-Oct-2006 : Version 1 (DG);
    038     *
    039     */
    040
    041    package org.jfree.data.xy;
    042
    043    import java.io.Serializable;
    044
    045    /**
    046     * A y-interval.  This class is used internally by the
    047     * {@link YIntervalDataItem} class.
    048     *
    049     * @since 1.0.3
    050     */
    051    public class YInterval implements Serializable {
    052
    053        /** The y-value. */
    054        private double y;
    055
    056        /** The lower bound of the y-interval. */
    057        private double yLow;
    058
    059        /** The upper bound of the y-interval. */
    060        private double yHigh;
    061
    062        /**
    063         * Creates a new instance of <code>YInterval</code>.
    064         *
    065         * @param y  the y-value.
    066         * @param yLow  the lower bound of the y-interval.
    067         * @param yHigh  the upper bound of the y-interval.
    068         */
    069        public YInterval(double y, double yLow, double yHigh) {
    070            this.y = y;
    071            this.yLow = yLow;
    072            this.yHigh = yHigh;
    073        }
    074
    075        /**
    076         * Returns the y-value.
    077         *
    078         * @return The y-value.
    079         */
    080        public double getY() {
    081            return this.y;
    082        }
    083
    084        /**
    085         * Returns the lower bound of the y-interval.
    086         *
    087         * @return The lower bound of the y-interval.
    088         */
    089        public double getYLow() {
    090            return this.yLow;
    091        }
    092
    093        /**
    094         * Returns the upper bound of the y-interval.
    095         *
    096         * @return The upper bound of the y-interval.
    097         */
    098        public double getYHigh() {
    099            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    }