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. * KeyedValues2D.java
  26. * ------------------
  27. * (C) Copyright 2002-2005, by Object Refinery Limited.
  28. *
  29. * Original Author: David Gilbert (for Object Refinery Limited);
  30. * Contributor(s): -;
  31. *
  32. * $Id: KeyedValues2D.java,v 1.2 2005/01/12 14:47:55 mungady Exp $
  33. *
  34. * Changes
  35. * -------
  36. * 28-Oct-2002 : Version 1 (DG);
  37. * 12-Jan-2005 : Updated Javadocs (DG);
  38. *
  39. */
  40. package org.jfree.data;
  41. import java.util.List;
  42. /**
  43. * An extension of the {@link Values2D} interface where a unique key is
  44. * associated with the row and column indices.
  45. */
  46. public interface KeyedValues2D extends Values2D {
  47. /**
  48. * Returns the row key for a given index.
  49. *
  50. * @param row the row index (zero-based).
  51. *
  52. * @return The row key.
  53. *
  54. * @throws IndexOutOfBoundsException if <code>row</code> is out of bounds.
  55. */
  56. public Comparable getRowKey(int row);
  57. /**
  58. * Returns the row index for a given key.
  59. *
  60. * @param key the row key.
  61. *
  62. * @return The row index, or <code>-1</code> if the key is unrecognised.
  63. */
  64. public int getRowIndex(Comparable key);
  65. /**
  66. * Returns the row keys.
  67. *
  68. * @return The keys.
  69. */
  70. public List getRowKeys();
  71. /**
  72. * Returns the column key for a given index.
  73. *
  74. * @param column the column index (zero-based).
  75. *
  76. * @return The column key.
  77. *
  78. * @throws IndexOutOfBoundsException if <code>row</code> is out of bounds.
  79. */
  80. public Comparable getColumnKey(int column);
  81. /**
  82. * Returns the column index for a given key.
  83. *
  84. * @param key the column key.
  85. *
  86. * @return The column index, or <code>-1</code> if the key is unrecognised.
  87. */
  88. public int getColumnIndex(Comparable key);
  89. /**
  90. * Returns the column keys.
  91. *
  92. * @return The keys.
  93. */
  94. public List getColumnKeys();
  95. /**
  96. * Returns the value associated with the specified keys. This method
  97. * should return <code>null</code> if either of the keys is not found.
  98. *
  99. * @param rowKey the row key.
  100. * @param columnKey the column key.
  101. *
  102. * @return The value.
  103. *
  104. * @throws UnknownKeyException if either key is not recognised.
  105. */
  106. public Number getValue(Comparable rowKey, Comparable columnKey);
  107. }