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,v 1.4 2002/01/29 01:15:18 lehors Exp $
Author:
Elena Litani

Inner Class Summary
protected static class SymbolHash.Entry
          This class is a key table entry.
 
Field Summary
protected  SymbolHash.Entry[] fBuckets
          Buckets.
protected  int fTableSize
          Default table size.
 
Constructor Summary
SymbolHash()
          Constructs a key table.
SymbolHash(int size)
           
 
Method Summary
 void clear()
           
 java.lang.Object get(org.apache.xerces.xni.QName qName)
           
 java.lang.Object get(java.lang.String key)
           
 int hash(java.lang.String key)
          Returns a hashcode value for the specified key.
 java.lang.String put(org.apache.xerces.xni.QName qName, java.lang.Object value)
          Adds the specified key to the key table and returns a reference to the unique key.
 java.lang.String put(java.lang.String key, java.lang.Object value)
          Adds the specified key to the key table and returns a reference to the unique key.
protected  SymbolHash.Entry search(java.lang.String 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.
Constructor Detail

SymbolHash

public SymbolHash()
Constructs a key table.

SymbolHash

public SymbolHash(int size)
Method Detail

put

public java.lang.String put(java.lang.String key,
                            java.lang.Object value)
Adds the specified key to the key table and returns a reference to the unique key. If the key already exists, the previous key reference is returned instead, in order guarantee that key references remain unique.
Parameters:
key - The new key.

put

public java.lang.String put(org.apache.xerces.xni.QName qName,
                            java.lang.Object value)
Adds the specified key to the key table and returns a reference to the unique key. If the key already exists, the previous key reference is returned instead, in order guarantee that key references remain unique.
Parameters:
qName - The QName which is the key
value -  

get

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

clear

public void clear()

get

public java.lang.Object get(org.apache.xerces.xni.QName qName)

search

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

hash

public int hash(java.lang.String key)
Returns a hashcode value for the specified key. The value returned by this method must be identical to the value returned by the hash(char[],int,int) method when called with the character array that comprises the key string.
Parameters:
key - The key to hash.


Copyright © 1999-2001 Apache XML Project. All Rights Reserved.