KickJava   Java API By Example, From Geeks To Geeks.

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


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  * XYIntervalDataItem.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: XYIntervalDataItem.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 org.jfree.data.ComparableObjectItem;
46
47 /**
48  * An item representing data in the form (x, x-low, x-high, y, y-low, y-high).
49  *
50  * @since 1.0.3
51  */

52 public class XYIntervalDataItem extends ComparableObjectItem {
53
54     /**
55      * Creates a new instance of <code>XYIntervalItem</code>.
56      *
57      * @param x the x-value.
58      * @param xLow the lower bound of the x-interval.
59      * @param xHigh the upper bound of the x-interval.
60      * @param y the y-value.
61      * @param yLow the lower bound of the y-interval.
62      * @param yHigh the upper bound of the y-interval.
63      */

64     public XYIntervalDataItem(double x, double xLow, double xHigh, double y,
65             double yLow, double yHigh) {
66         super(new Double JavaDoc(x), new XYInterval(xLow, xHigh, y, yLow, yHigh));
67     }
68     
69     /**
70      * Returns the x-value.
71      *
72      * @return The x-value (never <code>null</code>).
73      */

74     public Double JavaDoc getX() {
75         return (Double JavaDoc) getComparable();
76     }
77     
78     /**
79      * Returns the y-value.
80      *
81      * @return The y-value.
82      */

83     public double getYValue() {
84         XYInterval interval = (XYInterval) getObject();
85         if (interval != null) {
86             return interval.getY();
87         }
88         else {
89             return Double.NaN;
90         }
91     }
92     
93     /**
94      * Returns the lower bound of the x-interval.
95      *
96      * @return The lower bound of the x-interval.
97      */

98     public double getXLowValue() {
99         XYInterval interval = (XYInterval) getObject();
100         if (interval != null) {
101             return interval.getXLow();
102         }
103         else {
104             return Double.NaN;
105         }
106     }
107     
108     /**
109      * Returns the upper bound of the x-interval.
110      *
111      * @return The upper bound of the x-interval.
112      */

113     public double getXHighValue() {
114         XYInterval interval = (XYInterval) getObject();
115         if (interval != null) {
116             return interval.getXHigh();
117         }
118         else {
119             return Double.NaN;
120         }
121     }
122     
123     /**
124      * Returns the lower bound of the y-interval.
125      *
126      * @return The lower bound of the y-interval.
127      */

128     public double getYLowValue() {
129         XYInterval interval = (XYInterval) getObject();
130         if (interval != null) {
131             return interval.getYLow();
132         }
133         else {
134             return Double.NaN;
135         }
136     }
137     
138     /**
139      * Returns the upper bound of the y-interval.
140      *
141      * @return The upper bound of the y-interval.
142      */

143     public double getYHighValue() {
144         XYInterval interval = (XYInterval) getObject();
145         if (interval != null) {
146             return interval.getYHigh();
147         }
148         else {
149             return Double.NaN;
150         }
151     }
152     
153 }
154
Popular Tags