    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 * XYInterval.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
    041package org.jfree.data.xy;
    042
    043import java.io.Serializable;
    044
    045/**
    046 * An  xy-interval.  This class is used internally by the
    047 * {@link XYIntervalDataItem} class.
    048 *
    049 * @since 1.0.3
    050 */
    051public class XYInterval implements Serializable {
    052
    053    /** The lower bound of the x-interval. */
    054    private double xLow;
    055
    056    /** The upper bound of the y-interval. */
    057    private double xHigh;
    058
    059    /** The y-value. */
    060    private double y;
    061
    062    /** The lower bound of the y-interval. */
    063    private double yLow;
    064
    065    /** The upper bound of the y-interval. */
    066    private double yHigh;
    067
    068    /**
    069     * Creates a new instance of <code>XYInterval</code>.
    070     *
    071     * @param xLow  the lower bound of the x-interval.
    072     * @param xHigh  the upper bound of the y-interval.
    073     * @param y  the y-value.
    074     * @param yLow  the lower bound of the y-interval.
    075     * @param yHigh  the upper bound of the y-interval.
    076     */
    077    public XYInterval(double xLow, double xHigh, double y, double yLow,
    078            double yHigh) {
    079        this.xLow = xLow;
    080        this.xHigh = xHigh;
    081        this.y = y;
    082        this.yLow = yLow;
    083        this.yHigh = yHigh;
    084    }
    085
    086    /**
    087     * Returns the lower bound of the x-interval.
    088     *
    089     * @return The lower bound of the x-interval.
    090     */
    091    public double getXLow() {
    092        return this.xLow;
    093    }
    094
    095    /**
    096     * Returns the upper bound of the x-interval.
    097     *
    098     * @return The upper bound of the x-interval.
    099     */
    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}