com.orsoncharts.data

## Class DefaultKeyedValues2D<R extends java.lang.Comparable<R>,C extends java.lang.Comparable<C>,T>

- java.lang.Object
- - com.orsoncharts.data.DefaultKeyedValues2D<R,C,T>

- Type Parameters:
    `R` - the row key type
    `C` - the column key type
    `T` - the value type.
  All Implemented Interfaces:
    KeyedValues2D<R,C,T>, Values2D<T>, java.io.Serializable

      public final class DefaultKeyedValues2D<R extends java.lang.Comparable<R>,C extends java.lang.Comparable<C>,T>
      extends java.lang.Object
      implements KeyedValues2D<R,C,T>, java.io.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:
    Serialized Form

- - ### Constructor Summary

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

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equals(java.lang.Object obj)`
    `int` | `getColumnCount()` Returns the number of column keys in the data structure.
    `int` | `getColumnIndex(C columnKey)` Returns the index corresponding to the specified column key.
    `C` | `getColumnKey(int columnIndex)` Returns the column key corresponding to the specified index.
    `java.util.List<C>` | `getColumnKeys()` 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` | `getRowCount()` Returns the number of row keys in the table.
    `int` | `getRowIndex(R rowKey)` Returns the index corresponding to the specified row key.
    `R` | `getRowKey(int rowIndex)` Returns the row key corresponding to the specified index.
    `java.util.List<R>` | `getRowKeys()` Returns a copy of the list of row keys.
    `T` | `getValue(int rowIndex, int columnIndex)` Returns the value from one cell in the table.
    `T` | `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 Detail

    - #### DefaultKeyedValues2D

          public DefaultKeyedValues2D()

      Creates a new (empty) instance.

    - #### DefaultKeyedValues2D

          public DefaultKeyedValues2D(java.util.List<R> rowKeys,
                                      java.util.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 Detail

    - #### getRowKey

          public R getRowKey(int rowIndex)

      Returns the row key corresponding to the specified index.
      Specified by:
        `getRowKey` in interface `KeyedValues2D<R extends java.lang.Comparable<R>,C extends java.lang.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 java.lang.Comparable<R>,C extends java.lang.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 java.lang.Comparable<R>,C extends java.lang.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 java.lang.Comparable<R>,C extends java.lang.Comparable<C>,T>`
      Parameters:
        `columnKey` - the column key (`null` not permitted).
      Returns:
        The index.

    - #### getRowKeys

          public java.util.List<R> getRowKeys()

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

    - #### getColumnKeys

          public java.util.List<C> getColumnKeys()

      Returns a copy of the list of column keys.
      Specified by:
        `getColumnKeys` in interface `KeyedValues2D<R extends java.lang.Comparable<R>,C extends java.lang.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<T>`
      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<T>`
      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 java.lang.Comparable<R>,C extends java.lang.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<T>`
      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<T>`
      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(java.lang.Object obj)

      Overrides:
        `equals` in class `java.lang.Object`