Class DefaultKeyedValues2D<R extends Comparable<R>,C extends Comparable<C>,T>

java.lang.Object
org.jfree.chart3d.data.DefaultKeyedValues2D<R,C,T>
Type Parameters:
R - the row key type
C - the column key type
T - the value type.
All Implemented Interfaces:
Serializable, KeyedValues2D<R,C,T>, Values2D<T>

public final class DefaultKeyedValues2D<R extends Comparable<R>,C extends Comparable<C>,T> extends Object implements KeyedValues2D<R,C,T>, Serializable
A two dimensional grid of (typically numerical) data that is accessible by row and column keys.

NOTE: This class is serializable, but the serialization format is subject to change in future releases and should not be relied upon for persisting instances of this class.
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new (empty) instance.
    DefaultKeyedValues2D(List<R> rowKeys, List<C> columnKeys)
    Creates a new instance with the specified keys and all data values initialized to null.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
     
    int
    Returns the number of column keys in the data structure.
    int
    getColumnIndex(C columnKey)
    Returns the index corresponding to the specified column key.
    getColumnKey(int columnIndex)
    Returns the column key corresponding to the specified index.
    Returns a copy of the list of column keys.
    double
    getDoubleValue(int rowIndex, int columnIndex)
    Returns the data item at the specified position as a double primitive.
    int
    Returns the number of row keys in the table.
    int
    getRowIndex(R rowKey)
    Returns the index corresponding to the specified row key.
    getRowKey(int rowIndex)
    Returns the row key corresponding to the specified index.
    Returns a copy of the list of row keys.
    getValue(int rowIndex, int columnIndex)
    Returns the value from one cell in the table.
    getValue(R rowKey, C columnKey)
    Returns a value from one cell in the table.
    void
    setValue(T n, R rowKey, C columnKey)
    Sets a value for one cell in the table.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • DefaultKeyedValues2D

      Creates a new (empty) instance.
    • DefaultKeyedValues2D

      public DefaultKeyedValues2D(List<R> rowKeys, List<C> columnKeys)
      Creates a new instance with the specified keys and all data values initialized to null.
      Parameters:
      rowKeys - the xKeys (null not permitted).
      columnKeys - the yKeys (null not permitted).
  • Method Details

    • getRowKey

      public R getRowKey(int rowIndex)
      Returns the row key corresponding to the specified index.
      Specified by:
      getRowKey in interface KeyedValues2D<R extends Comparable<R>,C extends Comparable<C>,T>
      Parameters:
      rowIndex - the row index.
      Returns:
      The key.
    • getColumnKey

      public C getColumnKey(int columnIndex)
      Returns the column key corresponding to the specified index.
      Specified by:
      getColumnKey in interface KeyedValues2D<R extends Comparable<R>,C extends Comparable<C>,T>
      Parameters:
      columnIndex - the column index.
      Returns:
      The key.
    • getRowIndex

      public int getRowIndex(R rowKey)
      Returns the index corresponding to the specified row key.
      Specified by:
      getRowIndex in interface KeyedValues2D<R extends Comparable<R>,C extends Comparable<C>,T>
      Parameters:
      rowKey - the row key (null not permitted).
      Returns:
      The index.
    • getColumnIndex

      public int getColumnIndex(C columnKey)
      Returns the index corresponding to the specified column key.
      Specified by:
      getColumnIndex in interface KeyedValues2D<R extends Comparable<R>,C extends Comparable<C>,T>
      Parameters:
      columnKey - the column key (null not permitted).
      Returns:
      The index.
    • getRowKeys

      public List<R> getRowKeys()
      Returns a copy of the list of row keys.
      Specified by:
      getRowKeys in interface KeyedValues2D<R extends Comparable<R>,C extends Comparable<C>,T>
      Returns:
      A copy of the list of row keys (never null).
    • getColumnKeys

      public List<C> getColumnKeys()
      Returns a copy of the list of column keys.
      Specified by:
      getColumnKeys in interface KeyedValues2D<R extends Comparable<R>,C extends Comparable<C>,T>
      Returns:
      A copy of the list of column keys (never null).
    • getRowCount

      public int getRowCount()
      Returns the number of row keys in the table.
      Specified by:
      getRowCount in interface Values2D<R extends Comparable<R>>
      Returns:
      The number of row keys in the table.
    • getColumnCount

      public int getColumnCount()
      Returns the number of column keys in the data structure.
      Specified by:
      getColumnCount in interface Values2D<R extends Comparable<R>>
      Returns:
      The number of column keys.
    • getValue

      public T getValue(R rowKey, C columnKey)
      Returns a value from one cell in the table.
      Specified by:
      getValue in interface KeyedValues2D<R extends Comparable<R>,C extends Comparable<C>,T>
      Parameters:
      rowKey - the row-key (null not permitted).
      columnKey - the column-key (null not permitted).
      Returns:
      The value (possibly null).
    • getValue

      public T getValue(int rowIndex, int columnIndex)
      Returns the value from one cell in the table.
      Specified by:
      getValue in interface Values2D<R extends Comparable<R>>
      Parameters:
      rowIndex - the row index.
      columnIndex - the column index.
      Returns:
      The value (possibly null).
    • getDoubleValue

      public double getDoubleValue(int rowIndex, int columnIndex)
      Returns the data item at the specified position as a double primitive. Where the getValue(int, int) method returns null, this method returns Double.NaN.
      Specified by:
      getDoubleValue in interface Values2D<R extends Comparable<R>>
      Parameters:
      rowIndex - the row index.
      columnIndex - the column index.
      Returns:
      The data value.
    • setValue

      public void setValue(T n, R rowKey, C columnKey)
      Sets a value for one cell in the table.
      Parameters:
      n - the value (null permitted).
      rowKey - the row key (null not permitted).
      columnKey - the column key (null not permitted).
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object