Frames | No Frames |
1: /* =========================================================== 2: * JFreeChart : a free chart library for the Java(tm) platform 3: * =========================================================== 4: * 5: * (C) Copyright 2000-2007, 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, 2007, by Object Refinery Limited. 31: * 32: * Original Author: David Gilbert (for Object Refinery Limited); 33: * Contributor(s): -; 34: * 35: * Changes 36: * ------- 37: * 20-Oct-2006 : Version 1 (DG); 38: * 39: */ 40: 41: package org.jfree.data.xy; 42: 43: import org.jfree.data.ComparableObjectItem; 44: 45: /** 46: * An item representing data in the form (x, x-low, x-high, y, y-low, y-high). 47: * 48: * @since 1.0.3 49: */ 50: public class XYIntervalDataItem extends ComparableObjectItem { 51: 52: /** 53: * Creates a new instance of <code>XYIntervalItem</code>. 54: * 55: * @param x the x-value. 56: * @param xLow the lower bound of the x-interval. 57: * @param xHigh the upper bound of the x-interval. 58: * @param y the y-value. 59: * @param yLow the lower bound of the y-interval. 60: * @param yHigh the upper bound of the y-interval. 61: */ 62: public XYIntervalDataItem(double x, double xLow, double xHigh, double y, 63: double yLow, double yHigh) { 64: super(new Double(x), new XYInterval(xLow, xHigh, y, yLow, yHigh)); 65: } 66: 67: /** 68: * Returns the x-value. 69: * 70: * @return The x-value (never <code>null</code>). 71: */ 72: public Double getX() { 73: return (Double) getComparable(); 74: } 75: 76: /** 77: * Returns the y-value. 78: * 79: * @return The y-value. 80: */ 81: public double getYValue() { 82: XYInterval interval = (XYInterval) getObject(); 83: if (interval != null) { 84: return interval.getY(); 85: } 86: else { 87: return Double.NaN; 88: } 89: } 90: 91: /** 92: * Returns the lower bound of the x-interval. 93: * 94: * @return The lower bound of the x-interval. 95: */ 96: public double getXLowValue() { 97: XYInterval interval = (XYInterval) getObject(); 98: if (interval != null) { 99: return interval.getXLow(); 100: } 101: else { 102: return Double.NaN; 103: } 104: } 105: 106: /** 107: * Returns the upper bound of the x-interval. 108: * 109: * @return The upper bound of the x-interval. 110: */ 111: public double getXHighValue() { 112: XYInterval interval = (XYInterval) getObject(); 113: if (interval != null) { 114: return interval.getXHigh(); 115: } 116: else { 117: return Double.NaN; 118: } 119: } 120: 121: /** 122: * Returns the lower bound of the y-interval. 123: * 124: * @return The lower bound of the y-interval. 125: */ 126: public double getYLowValue() { 127: XYInterval interval = (XYInterval) getObject(); 128: if (interval != null) { 129: return interval.getYLow(); 130: } 131: else { 132: return Double.NaN; 133: } 134: } 135: 136: /** 137: * Returns the upper bound of the y-interval. 138: * 139: * @return The upper bound of the y-interval. 140: */ 141: public double getYHighValue() { 142: XYInterval interval = (XYInterval) getObject(); 143: if (interval != null) { 144: return interval.getYHigh(); 145: } 146: else { 147: return Double.NaN; 148: } 149: } 150: 151: }