org.apache.xerces.util

## Class SymbolHash

- java.lang.Object
- - org.apache.xerces.util.SymbolHash

-     public class SymbolHash
      extends java.lang.Object

  This class is an unsynchronized hash table primary used for String to Object mapping.

  The hash code uses the same algorithm as SymbolTable class.

  Version:
    $Id: SymbolHash.java 819653 2009-09-28 17:29:56Z knoaman $
  Author:
    Elena Litani

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `protected static class` | `SymbolHash.Entry` This class is a key table entry.

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected SymbolHash.Entry[]` | `fBuckets` Buckets.
    `protected int` | `fNum` Number of elements.
    `protected int` | `fTableSize` Default table size.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SymbolHash()` Constructs a key table with the default size.
    `SymbolHash(int size)` Constructs a key table with a given size.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `clear()` Remove all key/value assocaition.
    `java.lang.Object` | `get(java.lang.Object key)` Get the value associated with the given key.
    `java.lang.Object[]` | `getEntries()` Return key/value pairs of all entries in the map
    `int` | `getLength()` Get the number of key/value pairs stored in this table.
    `int` | `getValues(java.lang.Object[] elements, int from)` Add all values to the given array.
    `SymbolHash` | `makeClone()` Make a clone of this object.
    `void` | `put(java.lang.Object key, java.lang.Object value)` Adds the key/value mapping to the key table.
    `protected SymbolHash.Entry` | `search(java.lang.Object key, int bucket)`

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

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

- - ### Field Detail

    - #### fTableSize

          protected int fTableSize

      Default table size.

    - #### fBuckets

          protected SymbolHash.Entry[] fBuckets

      Buckets.

    - #### fNum

          protected int fNum

      Number of elements.

  - ### Constructor Detail

    - #### SymbolHash

          public SymbolHash()

      Constructs a key table with the default size.

    - #### SymbolHash

          public SymbolHash(int size)

      Constructs a key table with a given size.
      Parameters:
        `size` - the size of the key table.

  - ### Method Detail

    - #### put

          public void put(java.lang.Object key,
                          java.lang.Object value)

      Adds the key/value mapping to the key table. If the key already exists, the previous value associated with this key is overwritten by the new value.
      Parameters:
        `key` -
        `value` -

    - #### get

          public java.lang.Object get(java.lang.Object key)

      Get the value associated with the given key.
      Parameters:
        `key` -
      Returns:
        the value associated with the given key.

    - #### getLength

          public int getLength()

      Get the number of key/value pairs stored in this table.
      Returns:
        the number of key/value pairs stored in this table.

    - #### getValues

          public int getValues(java.lang.Object[] elements,
                               int from)

      Add all values to the given array. The array must have enough entry.
      Parameters:
        `elements` - the array to store the elements
        `from` - where to start store element in the array
      Returns:
        number of elements copied to the array

    - #### getEntries

          public java.lang.Object[] getEntries()

      Return key/value pairs of all entries in the map

    - #### makeClone

          public SymbolHash makeClone()

      Make a clone of this object.

    - #### clear

          public void clear()

      Remove all key/value assocaition. This tries to save a bit of GC'ing by at least keeping the fBuckets array around.

    - #### search

          protected SymbolHash.Entry search(java.lang.Object key,
                                            int bucket)

Copyright © 1999-2010 The Apache Software Foundation. All Rights Reserved.