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 * XYInterval.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: XYInterval.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 * An xy-interval. This class is used internally by the 049 * {@link XYIntervalDataItem} class. 050 * 051 * @since 1.0.3 052 */ 053 public class XYInterval implements Serializable { 054 055 /** The lower bound of the x-interval. */ 056 private double xLow; 057 058 /** The upper bound of the y-interval. */ 059 private double xHigh; 060 061 /** The y-value. */ 062 private double y; 063 064 /** The lower bound of the y-interval. */ 065 private double yLow; 066 067 /** The upper bound of the y-interval. */ 068 private double yHigh; 069 070 /** 071 * Creates a new instance of <code>XYInterval</code>. 072 * 073 * @param xLow the lower bound of the x-interval. 074 * @param xHigh the upper bound of the y-interval. 075 * @param y the y-value. 076 * @param yLow the lower bound of the y-interval. 077 * @param yHigh the upper bound of the y-interval. 078 */ 079 public XYInterval(double xLow, double xHigh, double y, double yLow, 080 double yHigh) { 081 this.xLow = xLow; 082 this.xHigh = xHigh; 083 this.y = y; 084 this.yLow = yLow; 085 this.yHigh = yHigh; 086 } 087 088 /** 089 * Returns the lower bound of the x-interval. 090 * 091 * @return The lower bound of the x-interval. 092 */ 093 public double getXLow() { 094 return this.xLow; 095 } 096 097 /** 098 * Returns the upper bound of the x-interval. 099 * 100 * @return The upper bound of the x-interval. 101 */ 102 public double getXHigh() { 103 return this.xHigh; 104 } 105 106 /** 107 * Returns the y-value. 108 * 109 * @return The y-value. 110 */ 111 public double getY() { 112 return this.y; 113 } 114 115 /** 116 * Returns the lower bound of the y-interval. 117 * 118 * @return The lower bound of the y-interval. 119 */ 120 public double getYLow() { 121 return this.yLow; 122 } 123 124 /** 125 * Returns the upper bound of the y-interval. 126 * 127 * @return The upper bound of the y-interval. 128 */ 129 public double getYHigh() { 130 return this.yHigh; 131 } 132 133 /** 134 * Tests this instance for equality with an arbitrary object. 135 * 136 * @param obj the object (<code>null</code> permitted). 137 * 138 * @return A boolean. 139 */ 140 public boolean equals(Object obj) { 141 if (obj == this) { 142 return true; 143 } 144 if (!(obj instanceof XYInterval)) { 145 return false; 146 } 147 XYInterval that = (XYInterval) obj; 148 if (this.xLow != that.xLow) { 149 return false; 150 } 151 if (this.xHigh != that.xHigh) { 152 return false; 153 } 154 if (this.y != that.y) { 155 return false; 156 } 157 if (this.yLow != that.yLow) { 158 return false; 159 } 160 if (this.yHigh != that.yHigh) { 161 return false; 162 } 163 return true; 164 } 165 166 }