Class AssocArray

java.lang.Object
com.portal.pcm.AssocArray
Direct Known Subclasses:
SparseArray

public class AssocArray extends Object
The AssocArray (or Associative Array)
  • Field Details

    • keys

      protected Vector<Integer> keys
      A vector that holds the keys used in the system.
    • values

      protected Vector<FList> values
      A vector that holds the values used in the system.
  • Constructor Details

    • AssocArray

      public AssocArray()
      Constructs an Associative Array.
  • Method Details

    • elements

      public Enumeration<FList> elements()
      Get an enumeration of values.
      Returns:
      an Enumeration object for the array values.
    • get

      public Object get(Object key)
      Returns a value from the array given its associative key. If multiple identical keys exist, returns first instance.
      Parameters:
      key - - Key object associated with value to lookup.
      Returns:
      the value object associated with key.
    • isEmpty

      public boolean isEmpty()
      Returns true if the array is empty.
      Returns:
      true if the array is empty.
    • keys

      public Enumeration<Integer> keys()
      Get an enumeration of keys.
      Returns:
      an Enumeration object for the array keys.
    • put

      public Object put(Integer key, FList value) throws NullPointerException
      Adds a key:value association to the array.
      Parameters:
      key - New associative key.
      value - New value to associate with key.
      Returns:
      If key was present already, returns old value object.
      Throws:
      NullPointerException - is thrown if value is null.
    • remove

      public Object remove(Object key)
      Removes the first instance of key and its associated value.
      Parameters:
      key - the key to remove.
      Returns:
      The value associated with key.
    • size

      public int size()
      Returns the number of keys in the associative array.
      Returns:
      The number of keys stored in the array.
    • clear

      public void clear()
      Removes all keys and values from the array.
    • containsKey

      public boolean containsKey(Object key)
      Returns true if the array contains the value of a specific key.
      Parameters:
      key - Key to look for.
      Returns:
      true if key exists in array.
    • getPairs

      public AssocArray.PairEnumeration getPairs()
      Returns an enumeration of pairs.

      This method provides an enumeration over pairs of keys and values.

      Returns:
      An instance of AssocArray.PairEnumeration that enumerates the pairs.