edu.northwestern.at.utils

## Class HashMap3D<K1 extends java.lang.Comparable,K2 extends java.lang.Comparable,K3 extends java.lang.Comparable,V>

- java.lang.Object
- - edu.northwestern.at.utils.HashMap3D<K1,K2,K3,V>

- All Implemented Interfaces:
    Map3D<K1,K2,K3,V>

      public class HashMap3D<K1 extends java.lang.Comparable,K2 extends java.lang.Comparable,K3 extends java.lang.Comparable,V>
      extends java.lang.Object
      implements Map3D<K1,K2,K3,V>

  Three dimensional Map.

  The three dimensional map is implemented using a regular map with keys formed by concatenating the toString() values of individual keys.

  Example of use:

  > `HashMap3D map = new HashMap3D(); map.put( "a" , "b" , "c" , "my value" ); String s = map.get( "a" , "b" , "c" );`

  Note: HashMap3D does not implement the Map interface.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected java.util.Map<K1,java.util.Map<K2,java.util.Map<K3,V>>>` | `localMap` The map used to hold the multikey data.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `HashMap3D()` Create three dimensional hash map.
    `HashMap3D(int initialCapacity)` Create three dimensional map with specified initial row capacity.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `clear()` Clear all entries.
    `java.util.Set<K2>` | `columnKeySet()` Get column key set.
    `boolean` | `containsKey(CompoundKey key)` Determine if map contains a compound key.
    `boolean` | `containsKeys(java.lang.Object rowKey, java.lang.Object columnKey, java.lang.Object sliceKey)` Determine if map contains a key triple.
    `V` | `get(CompoundKey key)` Get value at specified CompoundKey position.
    `V` | `get(java.lang.Object rowKey, java.lang.Object columnKey, java.lang.Object sliceKey)` Get value at specified (rowKey, columnKey, sliceKey) position.
    `java.util.Iterator<CompoundKey>` | `iterator()` Get iterator over keys.
    `java.util.Set<CompoundKey>` | `keySet()` Get the compound key set.
    `V` | `put(K1 rowKey, K2 columnKey, K3 sliceKey, V value)` Add value for specified (rowKey, columnKey, sliceKey).
    `V` | `remove(java.lang.Object rowKey, java.lang.Object columnKey, java.lang.Object sliceKey)` Remove entry at (rowKey, columnKey, sliceKey).
    `java.util.Set<K1>` | `rowKeySet()` Get row key set.
    `int` | `size()` Return number of entries.
    `java.util.Set<K3>` | `sliceKeySet()` Get slice key set.
    `java.lang.String` | `toString()` Return formatted string displaying all entries.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### localMap

          protected java.util.Map<K1 extends java.lang.Comparable,java.util.Map<K2 extends java.lang.Comparable,java.util.Map<K3 extends java.lang.Comparable,V>>> localMap

      The map used to hold the multikey data.

  - ### Constructor Detail

    - #### HashMap3D

          public HashMap3D()

      Create three dimensional hash map.

    - #### HashMap3D

          public HashMap3D(int initialCapacity)

      Create three dimensional map with specified initial row capacity.
      Parameters:
        `initialCapacity` -

  - ### Method Detail

    - #### clear

          public void clear()

      Clear all entries.
      Specified by:
        `clear` in interface `Map3D<K1 extends java.lang.Comparable,K2 extends java.lang.Comparable,K3 extends java.lang.Comparable,V>`

    - #### size

          public int size()

      Return number of entries.
      Specified by:
        `size` in interface `Map3D<K1 extends java.lang.Comparable,K2 extends java.lang.Comparable,K3 extends java.lang.Comparable,V>`
      Returns:
        Number of entries in map.

        The number of entries is given by the sum of the number of entries for each submap.

    - #### containsKeys

          public boolean containsKeys(java.lang.Object rowKey,
                             java.lang.Object columnKey,
                             java.lang.Object sliceKey)

      Determine if map contains a key triple.
      Specified by:
        `containsKeys` in interface `Map3D<K1 extends java.lang.Comparable,K2 extends java.lang.Comparable,K3 extends java.lang.Comparable,V>`
      Parameters:
        `rowKey` - Row key.
        `columnKey` - Column key.
        `sliceKey` - Slice key.
      Returns:
        true if entry exists, false otherwise.

    - #### containsKey

          public boolean containsKey(CompoundKey key)

      Determine if map contains a compound key.
      Specified by:
        `containsKey` in interface `Map3D<K1 extends java.lang.Comparable,K2 extends java.lang.Comparable,K3 extends java.lang.Comparable,V>`
      Parameters:
        `key` - Compound key.
      Returns:
        true if entry exists, false otherwise.

    - #### get

          public V get(java.lang.Object rowKey,
              java.lang.Object columnKey,
              java.lang.Object sliceKey)

      Get value at specified (rowKey, columnKey, sliceKey) position.
      Specified by:
        `get` in interface `Map3D<K1 extends java.lang.Comparable,K2 extends java.lang.Comparable,K3 extends java.lang.Comparable,V>`
      Parameters:
        `rowKey` - Row key.
        `columnKey` - Column key.
        `sliceKey` - Slice key.
      Returns:
        Value at (rowKey, columnKey, sliceKey) position.

    - #### get

          public V get(CompoundKey key)

      Get value at specified CompoundKey position.
      Specified by:
        `get` in interface `Map3D<K1 extends java.lang.Comparable,K2 extends java.lang.Comparable,K3 extends java.lang.Comparable,V>`
      Parameters:
        `key` - Compound key.
      Returns:
        The value at the specified compound key position.

    - #### put

          public V put(K1 rowKey,
              K2 columnKey,
              K3 sliceKey,
              V value)

      Add value for specified (rowKey, columnKey, sliceKey).
      Specified by:
        `put` in interface `Map3D<K1 extends java.lang.Comparable,K2 extends java.lang.Comparable,K3 extends java.lang.Comparable,V>`
      Parameters:
        `rowKey` - Row key.
        `columnKey` - Column key.
        `sliceKey` - Slice key.
        `value` - Value to store.
      Returns:
        Previous value for (rowKey, columnKey, sliceKey). May be null.

    - #### remove

          public V remove(java.lang.Object rowKey,
                 java.lang.Object columnKey,
                 java.lang.Object sliceKey)

      Remove entry at (rowKey, columnKey, sliceKey).
      Specified by:
        `remove` in interface `Map3D<K1 extends java.lang.Comparable,K2 extends java.lang.Comparable,K3 extends java.lang.Comparable,V>`
      Parameters:
        `rowKey` - Row key.
        `columnKey` - Column key.
        `sliceKey` - Slice key.
      Returns:
        Previous value for (rowKey, columnKey, sliceKey). May be null.

    - #### keySet

          public java.util.Set<CompoundKey> keySet()

      Get the compound key set.
      Specified by:
        `keySet` in interface `Map3D<K1 extends java.lang.Comparable,K2 extends java.lang.Comparable,K3 extends java.lang.Comparable,V>`
      Returns:
        The compound key set.

    - #### rowKeySet

          public java.util.Set<K1> rowKeySet()

      Get row key set.
      Specified by:
        `rowKeySet` in interface `Map3D<K1 extends java.lang.Comparable,K2 extends java.lang.Comparable,K3 extends java.lang.Comparable,V>`
      Returns:
        rows key set.

    - #### columnKeySet

          public java.util.Set<K2> columnKeySet()

      Get column key set.
      Specified by:
        `columnKeySet` in interface `Map3D<K1 extends java.lang.Comparable,K2 extends java.lang.Comparable,K3 extends java.lang.Comparable,V>`
      Returns:
        column key set.

    - #### sliceKeySet

          public java.util.Set<K3> sliceKeySet()

      Get slice key set.
      Specified by:
        `sliceKeySet` in interface `Map3D<K1 extends java.lang.Comparable,K2 extends java.lang.Comparable,K3 extends java.lang.Comparable,V>`
      Returns:
        slice key set.

    - #### iterator

          public java.util.Iterator<CompoundKey> iterator()

      Get iterator over keys.
      Specified by:
        `iterator` in interface `Map3D<K1 extends java.lang.Comparable,K2 extends java.lang.Comparable,K3 extends java.lang.Comparable,V>`
      Returns:
        Compound key iterator.

    - #### toString

          public java.lang.String toString()

      Return formatted string displaying all entries.
      Overrides:
        `toString` in class `java.lang.Object`
      Returns:
        Formatted string displaying all entries.