1. /* ===========================================================
  2. * JFreeChart : a free chart library for the Java(tm) platform
  3. * ===========================================================
  4. *
  5. * (C) Copyright 2000-2005, 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 under the terms
  10. * of the GNU Lesser General Public License as published by the Free Software Foundation;
  11. * either version 2.1 of the License, or (at your option) any later version.
  12. *
  13. * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
  14. * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  15. * See the GNU Lesser General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Lesser General Public License along with this
  18. * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
  19. * Boston, MA 02111-1307, USA.
  20. *
  21. * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
  22. * in the United States and other countries.]
  23. *
  24. * ------------------------------
  25. * AbstractIntervalXYDataset.java
  26. * ------------------------------
  27. * (C) Copyright 2004-2005, by Object Refinery Limited.
  28. *
  29. * Original Author: David Gilbert (for Object Refinery Limited).
  30. * Contributor(s): -;
  31. *
  32. * $Id: AbstractIntervalXYDataset.java,v 1.2 2005/01/28 14:11:43 mungady Exp $
  33. *
  34. * Changes
  35. * -------
  36. * 05-May-2004 : Version 1 (DG);
  37. * 15-Jul-2004 : Switched getStartX() and getStartXValue() methods and
  38. * others (DG);
  39. * 18-Aug-2004 : Moved from org.jfree.data --> org.jfree.data.xy (DG);
  40. *
  41. */
  42. package org.jfree.data.xy;
  43. /**
  44. * An base class that you can use to create new implementations of the
  45. * {@link IntervalXYDataset} interface.
  46. */
  47. public abstract class AbstractIntervalXYDataset extends AbstractXYDataset
  48. implements IntervalXYDataset {
  49. /**
  50. * Returns the start x-value (as a double primitive) for an item within a
  51. * series.
  52. *
  53. * @param series the series index (zero-based).
  54. * @param item the item index (zero-based).
  55. *
  56. * @return The value.
  57. */
  58. public double getStartXValue(int series, int item) {
  59. double result = Double.NaN;
  60. Number x = getStartX(series, item);
  61. if (x != null) {
  62. result = x.doubleValue();
  63. }
  64. return result;
  65. }
  66. /**
  67. * Returns the end x-value (as a double primitive) for an item within a
  68. * series.
  69. *
  70. * @param series the series index (zero-based).
  71. * @param item the item index (zero-based).
  72. *
  73. * @return The value.
  74. */
  75. public double getEndXValue(int series, int item) {
  76. double result = Double.NaN;
  77. Number x = getEndX(series, item);
  78. if (x != null) {
  79. result = x.doubleValue();
  80. }
  81. return result;
  82. }
  83. /**
  84. * Returns the start y-value (as a double primitive) for an item within a
  85. * series.
  86. *
  87. * @param series the series index (zero-based).
  88. * @param item the item index (zero-based).
  89. *
  90. * @return The value.
  91. */
  92. public double getStartYValue(int series, int item) {
  93. double result = Double.NaN;
  94. Number y = getStartY(series, item);
  95. if (y != null) {
  96. result = y.doubleValue();
  97. }
  98. return result;
  99. }
  100. /**
  101. * Returns the end y-value (as a double primitive) for an item within a
  102. * series.
  103. *
  104. * @param series the series (zero-based index).
  105. * @param item the item (zero-based index).
  106. *
  107. * @return The value.
  108. */
  109. public double getEndYValue(int series, int item) {
  110. double result = Double.NaN;
  111. Number y = getEndY(series, item);
  112. if (y != null) {
  113. result = y.doubleValue();
  114. }
  115. return result;
  116. }
  117. }