001/* ===========================================================
002 * JFreeChart : a free chart library for the Java(tm) platform
003 * ===========================================================
004 *
005 * (C) Copyright 2000-present, by David Gilbert 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-present, by David Gilbert.
031 *
032 * Original Author:  David Gilbert;
033 * Contributor(s):   -;
034 *
035 */
036
037package org.jfree.data.xy;
038
039import java.io.Serializable;
040
041/**
042 * An  xy-interval.  This class is used internally by the
043 * {@link XYIntervalDataItem} class.
044 */
045public class XYInterval implements Serializable {
046
047    /** The lower bound of the x-interval. */
048    private double xLow;
049
050    /** The upper bound of the y-interval. */
051    private double xHigh;
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 XYInterval}.
064     *
065     * @param xLow  the lower bound of the x-interval.
066     * @param xHigh  the upper bound of the y-interval.
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 XYInterval(double xLow, double xHigh, double y, double yLow,
072            double yHigh) {
073        this.xLow = xLow;
074        this.xHigh = xHigh;
075        this.y = y;
076        this.yLow = yLow;
077        this.yHigh = yHigh;
078    }
079
080    /**
081     * Returns the lower bound of the x-interval.
082     *
083     * @return The lower bound of the x-interval.
084     */
085    public double getXLow() {
086        return this.xLow;
087    }
088
089    /**
090     * Returns the upper bound of the x-interval.
091     *
092     * @return The upper bound of the x-interval.
093     */
094    public double getXHigh() {
095        return this.xHigh;
096    }
097
098    /**
099     * Returns the y-value.
100     *
101     * @return The y-value.
102     */
103    public double getY() {
104        return this.y;
105    }
106
107    /**
108     * Returns the lower bound of the y-interval.
109     *
110     * @return The lower bound of the y-interval.
111     */
112    public double getYLow() {
113        return this.yLow;
114    }
115
116    /**
117     * Returns the upper bound of the y-interval.
118     *
119     * @return The upper bound of the y-interval.
120     */
121    public double getYHigh() {
122        return this.yHigh;
123    }
124
125    /**
126     * Tests this instance for equality with an arbitrary object.
127     *
128     * @param obj  the object ({@code null} permitted).
129     *
130     * @return A boolean.
131     */
132    @Override
133    public boolean equals(Object obj) {
134        if (obj == this) {
135            return true;
136        }
137        if (!(obj instanceof XYInterval)) {
138            return false;
139        }
140        XYInterval that = (XYInterval) obj;
141        if (this.xLow != that.xLow) {
142            return false;
143        }
144        if (this.xHigh != that.xHigh) {
145            return false;
146        }
147        if (this.y != that.y) {
148            return false;
149        }
150        if (this.yLow != that.yLow) {
151            return false;
152        }
153        if (this.yHigh != that.yHigh) {
154            return false;
155        }
156        return true;
157    }
158
159}