Class CustomHashtable<V>

java.lang.Object
java.util.Dictionary<String,V>
java.util.Hashtable<String,V>
gov.nih.mipav.model.structures.CustomHashtable<V>
All Implemented Interfaces:
Serializable, Cloneable, Map<String,V>

public class CustomHashtable<V> extends Hashtable<String,V>
CustomHashtable extends the Hashtable class and adds some methods for generating keys for new elements to the Hashtable. This is designed for storing the active images, but can also be used for image frames or any other list that needs to enforce unique keys.
Version:
0.1 November 16, 2001
Author:
Lynne M. Pusanik
See Also:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      Use serialVersionUID for interoperability.
      See Also:
  • Constructor Details

    • CustomHashtable

      public CustomHashtable()
      Constructs a new, empty hashtable with a default capacity and load factor, which is 0.75.
    • CustomHashtable

      public CustomHashtable(Map<String,V> t)
      Constructs a new hashtable with the same mappings as the given Map. The hashtable is created with a capacity of twice the number of entries in the given Map or 11 (whichever is greater), and a default load factor, which is 0.75.
      Parameters:
      t - Map to base the hashtable on
    • CustomHashtable

      public CustomHashtable(int capacity)
      Constructs a new, empty hashtable with the specified initial capacity and default load factor, which is 0.75.
      Parameters:
      capacity - initial capacity of the hashtable
    • CustomHashtable

      public CustomHashtable(int capacity, float loadFactor)
      Constructs a new, empty hashtable with the specified initial capacity and the specified load factor.
      Parameters:
      capacity - initial capacity of the hashtable
      loadFactor - the load factor of the hashtable
  • Method Details

    • makeUniqueKey

      public String makeUniqueKey(String key)
      Returns a unique key string for the hashtable based on a given key string.
      Parameters:
      key - A string that we want to base a hashtable key on.
      Returns:
      A unique key, which should be used as an input to the
      invalid reference
      put()
      method.
    • appendKey

      protected String appendKey(String key) throws NullPointerException
      Starts with a key that already exists in the hashtable and appends integers to its toString(). Throws a NullPointer Exception if a unique key can't be found after appending all the integer values.
      Parameters:
      key - DOCUMENT ME!
      Returns:
      returns the newly formed key.
      Throws:
      NullPointerException - thrown when key cannot be appended to make a unique key.