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: * YWithXInterval.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: YWithXInterval.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-value plus the bounds for the related x-interval. This curious
049: * combination exists as an implementation detail, to fit into the structure
050: * of the ComparableObjectSeries class. It would have been possible to
051: * simply reuse the {@link YInterval} class by assuming that the y-interval
052: * in fact represents the x-interval, however I decided it was better to
053: * duplicate some code in order to document the real intent.
054: *
055: * @since 1.0.3
056: */
057: public class YWithXInterval implements Serializable {
058:
059: /** The y-value. */
060: private double y;
061:
062: /** The lower bound of the x-interval. */
063: private double xLow;
064:
065: /** The upper bound of the x-interval. */
066: private double xHigh;
067:
068: /**
069: * Creates a new instance of <code>YWithXInterval</code>.
070: *
071: * @param y the y-value.
072: * @param xLow the lower bound of the x-interval.
073: * @param xHigh the upper bound of the x-interval.
074: */
075: public YWithXInterval(double y, double xLow, double xHigh) {
076: this .y = y;
077: this .xLow = xLow;
078: this .xHigh = xHigh;
079: }
080:
081: /**
082: * Returns the y-value.
083: *
084: * @return The y-value.
085: */
086: public double getY() {
087: return this .y;
088: }
089:
090: /**
091: * Returns the lower bound of the x-interval.
092: *
093: * @return The lower bound of the x-interval.
094: */
095: public double getXLow() {
096: return this .xLow;
097: }
098:
099: /**
100: * Returns the upper bound of the x-interval.
101: *
102: * @return The upper bound of the x-interval.
103: */
104: public double getXHigh() {
105: return this .xHigh;
106: }
107:
108: /**
109: * Tests this instance for equality with an arbitrary object.
110: *
111: * @param obj the object (<code>null</code> permitted).
112: *
113: * @return A boolean.
114: */
115: public boolean equals(Object obj) {
116: if (obj == this ) {
117: return true;
118: }
119: if (!(obj instanceof YWithXInterval)) {
120: return false;
121: }
122: YWithXInterval that = (YWithXInterval) obj;
123: if (this .y != that.y) {
124: return false;
125: }
126: if (this .xLow != that.xLow) {
127: return false;
128: }
129: if (this .xHigh != that.xHigh) {
130: return false;
131: }
132: return true;
133: }
134:
135: }
|