edu.northwestern.at.utils

## Class CompressedHashMap<K,V>

- java.lang.Object
- - edu.northwestern.at.utils.CompressedHashMap<K,V>

- All Implemented Interfaces:
    java.util.Map<K,V>

      public class CompressedHashMap<K,V>
      extends java.lang.Object
      implements java.util.Map<K,V>

  A hash map which stores its values in compressed form.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface java.util.Map

      `java.util.Map.Entry<K,V>`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected java.util.HashMap<K,java.lang.Object>` | `delegateMap` The delagated-to hash map used to store the compressed values.
    `protected static CompressedSerializer` | `serializer` The object compressor for the values in the hash map.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `CompressedHashMap()` Create hash map.
    `CompressedHashMap(int initialCapacity)` Create hash map with specified initial capacity.
    `CompressedHashMap(int initialCapacity, float loadFactor)` Create hash map with specified initial capacity and load factor.
    `CompressedHashMap(java.util.Map<? extends K,? extends V> map)` Create hash map from another map.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `clear()`
    `java.lang.Object` | `clone()`
    `protected java.lang.Object` | `compress(java.lang.Object o)`
    `boolean` | `containsKey(java.lang.Object key)`
    `boolean` | `containsValue(java.lang.Object value)`
    `protected V` | `decompress(java.lang.Object o)`
    `java.util.Set<java.util.Map.Entry<K,V>>` | `entrySet()`
    `V` | `get(java.lang.Object key)`
    `boolean` | `isEmpty()`
    `java.util.Set<K>` | `keySet()`
    `V` | `put(K key, V value)`
    `void` | `putAll(java.util.Map<? extends K,? extends V> m)`
    `V` | `remove(java.lang.Object key)`
    `int` | `size()`
    `java.util.Collection<V>` | `values()`

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

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

    - ### Methods inherited from interface java.util.Map

      `equals, hashCode`

- - ### Field Detail

    - #### serializer

          protected static CompressedSerializer serializer

      The object compressor for the values in the hash map.

    - #### delegateMap

          protected java.util.HashMap<K,java.lang.Object> delegateMap

      The delagated-to hash map used to store the compressed values.

  - ### Constructor Detail

    - #### CompressedHashMap

          public CompressedHashMap()

      Create hash map.

    - #### CompressedHashMap

          public CompressedHashMap(int initialCapacity)

      Create hash map with specified initial capacity.
      Parameters:
        `initialCapacity` - The initial capacity.

    - #### CompressedHashMap

          public CompressedHashMap(int initialCapacity,
                           float loadFactor)

      Create hash map with specified initial capacity and load factor.
      Parameters:
        `initialCapacity` - The initial capacity.
        `loadFactor` - The load factor.

    - #### CompressedHashMap

          public CompressedHashMap(java.util.Map<? extends K,? extends V> map)

      Create hash map from another map.
      Parameters:
        `map` - The other map from which to load entries.

  - ### Method Detail

    - #### decompress

          protected V decompress(java.lang.Object o)

    - #### compress

          protected java.lang.Object compress(java.lang.Object o)

    - #### clear

          public void clear()
                     throws java.lang.UnsupportedOperationException

      Specified by:
        `clear` in interface `java.util.Map<K,V>`
      Throws:
        `java.lang.UnsupportedOperationException`

    - #### clone

          public java.lang.Object clone()

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

    - #### containsKey

          public boolean containsKey(java.lang.Object key)
                              throws java.lang.ClassCastException,
                                     java.lang.NullPointerException

      Specified by:
        `containsKey` in interface `java.util.Map<K,V>`
      Throws:
        `java.lang.ClassCastException`
        `java.lang.NullPointerException`

    - #### containsValue

          public boolean containsValue(java.lang.Object value)
                                throws java.lang.ClassCastException,
                                       java.lang.NullPointerException

      Specified by:
        `containsValue` in interface `java.util.Map<K,V>`
      Throws:
        `java.lang.ClassCastException`
        `java.lang.NullPointerException`

    - #### entrySet

          public java.util.Set<java.util.Map.Entry<K,V>> entrySet()

      Specified by:
        `entrySet` in interface `java.util.Map<K,V>`

    - #### isEmpty

          public boolean isEmpty()

      Specified by:
        `isEmpty` in interface `java.util.Map<K,V>`

    - #### keySet

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

      Specified by:
        `keySet` in interface `java.util.Map<K,V>`

    - #### size

          public int size()

      Specified by:
        `size` in interface `java.util.Map<K,V>`

    - #### putAll

          public void putAll(java.util.Map<? extends K,? extends V> m)
                      throws java.lang.UnsupportedOperationException,
                             java.lang.ClassCastException,
                             java.lang.NullPointerException,
                             java.lang.IllegalArgumentException

      Specified by:
        `putAll` in interface `java.util.Map<K,V>`
      Throws:
        `java.lang.UnsupportedOperationException`
        `java.lang.ClassCastException`
        `java.lang.NullPointerException`
        `java.lang.IllegalArgumentException`

    - #### values

          public java.util.Collection<V> values()

      Specified by:
        `values` in interface `java.util.Map<K,V>`

    - #### remove

          public V remove(java.lang.Object key)
                   throws java.lang.UnsupportedOperationException,
                          java.lang.ClassCastException,
                          java.lang.NullPointerException

      Specified by:
        `remove` in interface `java.util.Map<K,V>`
      Throws:
        `java.lang.UnsupportedOperationException`
        `java.lang.ClassCastException`
        `java.lang.NullPointerException`

    - #### get

          public V get(java.lang.Object key)
                throws java.lang.ClassCastException,
                       java.lang.NullPointerException

      Specified by:
        `get` in interface `java.util.Map<K,V>`
      Throws:
        `java.lang.ClassCastException`
        `java.lang.NullPointerException`

    - #### put

          public V put(K key,
              V value)
                throws java.lang.UnsupportedOperationException,
                       java.lang.ClassCastException,
                       java.lang.NullPointerException,
                       java.lang.IllegalArgumentException

      Specified by:
        `put` in interface `java.util.Map<K,V>`
      Throws:
        `java.lang.UnsupportedOperationException`
        `java.lang.ClassCastException`
        `java.lang.NullPointerException`
        `java.lang.IllegalArgumentException`