KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jfree > data > xy > YInterval


1 /* ===========================================================
2  * JFreeChart : a free chart library for the Java(tm) platform
3  * ===========================================================
4  *
5  * (C) Copyright 2000-2006, by Object Refinery Limited and Contributors.
6  *
7  * Project Info: http://www.jfree.org/jfreechart/index.html
8  *
9  * This library is free software; you can redistribute it and/or modify it
10  * under the terms of the GNU Lesser General Public License as published by
11  * the Free Software Foundation; either version 2.1 of the License, or
12  * (at your option) any later version.
13  *
14  * This library is distributed in the hope that it will be useful, but
15  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
17  * License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with this library; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
22  * USA.
23  *
24  * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
25  * in the United States and other countries.]
26  *
27  * --------------
28  * YInterval.java
29  * --------------
30  * (C) Copyright 2006, by Object Refinery Limited.
31  *
32  * Original Author: David Gilbert (for Object Refinery Limited);
33  * Contributor(s): -;
34  *
35  * $Id: YInterval.java,v 1.1.2.1 2006/10/20 15:23:22 mungady Exp $
36  *
37  * Changes
38  * -------
39  * 20-Oct-2006 : Version 1 (DG);
40  *
41  */

42
43 package org.jfree.data.xy;
44
45 import java.io.Serializable JavaDoc;
46
47 /**
48  * A y-interval. This class is used internally by the
49  * {@link YIntervalDataItem} class.
50  *
51  * @since 1.0.3
52  */

53 public class YInterval implements Serializable JavaDoc {
54     
55     /** The y-value. */
56     private double y;
57     
58     /** The lower bound of the y-interval. */
59     private double yLow;
60     
61     /** The upper bound of the y-interval. */
62     private double yHigh;
63     
64     /**
65      * Creates a new instance of <code>YInterval</code>.
66      *
67      * @param y the y-value.
68      * @param yLow the lower bound of the y-interval.
69      * @param yHigh the upper bound of the y-interval.
70      */

71     public YInterval(double y, double yLow, double yHigh) {
72         this.y = y;
73         this.yLow = yLow;
74         this.yHigh = yHigh;
75     }
76     
77     /**
78      * Returns the y-value.
79      *
80      * @return The y-value.
81      */

82     public double getY() {
83         return this.y;
84     }
85     
86     /**
87      * Returns the lower bound of the y-interval.
88      *
89      * @return The lower bound of the y-interval.
90      */

91     public double getYLow() {
92         return this.yLow;
93     }
94     
95     /**
96      * Returns the upper bound of the y-interval.
97      *
98      * @return The upper bound of the y-interval.
99      */

100     public double getYHigh() {
101         return this.yHigh;
102     }
103     
104     /**
105      * Tests this instance for equality with an arbitrary object.
106      *
107      * @param obj the object (<code>null</code> permitted).
108      *
109      * @return A boolean.
110      */

111     public boolean equals(Object JavaDoc obj) {
112         if (obj == this) {
113             return true;
114         }
115         if (!(obj instanceof YInterval)) {
116             return false;
117         }
118         YInterval that = (YInterval) obj;
119         if (this.y != that.y) {
120             return false;
121         }
122         if (this.yLow != that.yLow) {
123             return false;
124         }
125         if (this.yHigh != that.yHigh) {
126             return false;
127         }
128         return true;
129     }
130     
131 }
132
Popular Tags