org.apache.xml.serializer
Class ToHTMLStream.Trie

java.lang.Object
  extended by org.apache.xml.serializer.ToHTMLStream.Trie
Enclosing class:
ToHTMLStream

static class ToHTMLStream.Trie
extends java.lang.Object


Nested Class Summary
private static class ToHTMLStream.Trie.Node
          The node representation for the trie.
 
Field Summary
static int ALPHA_SIZE
          Size of the m_nextChar array.
private  char[] m_charBuffer
          helper buffer to convert Strings to char arrays
private  boolean m_lowerCaseOnly
          true if the search for an object is lower case only with the key
(package private)  ToHTMLStream.Trie.Node m_Root
          The root node of the tree.
 
Constructor Summary
ToHTMLStream.Trie()
          Construct the trie that has a case insensitive search.
ToHTMLStream.Trie(boolean lowerCaseOnly)
          Construct the trie given the desired case sensitivity with the key.
ToHTMLStream.Trie(ToHTMLStream.Trie existingTrie)
          Construct the trie from another Trie.
 
Method Summary
 java.lang.Object get(java.lang.String key)
          Get an object that matches the key.
 java.lang.Object get2(java.lang.String key)
          Get an object that matches the key.
 int getLongestKeyLength()
          Get the length of the longest key used in the table.
 java.lang.Object put(java.lang.String key, java.lang.Object value)
          Put an object into the trie for lookup.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ALPHA_SIZE

public static final int ALPHA_SIZE
Size of the m_nextChar array.

See Also:
Constant Field Values

m_Root

final ToHTMLStream.Trie.Node m_Root
The root node of the tree.


m_charBuffer

private char[] m_charBuffer
helper buffer to convert Strings to char arrays


m_lowerCaseOnly

private final boolean m_lowerCaseOnly
true if the search for an object is lower case only with the key

Constructor Detail

ToHTMLStream.Trie

public ToHTMLStream.Trie()
Construct the trie that has a case insensitive search.


ToHTMLStream.Trie

public ToHTMLStream.Trie(boolean lowerCaseOnly)
Construct the trie given the desired case sensitivity with the key.

Parameters:
lowerCaseOnly - true if the search keys are to be loser case only, not case insensitive.

ToHTMLStream.Trie

public ToHTMLStream.Trie(ToHTMLStream.Trie existingTrie)
Construct the trie from another Trie. Both the existing Trie and this new one share the same table for lookup, and it is assumed that the table is fully populated and not changing anymore.

Parameters:
existingTrie - the Trie that this one is a copy of.
Method Detail

put

public java.lang.Object put(java.lang.String key,
                            java.lang.Object value)
Put an object into the trie for lookup.

Parameters:
key - must be a 7-bit ASCII string
value - any java object.
Returns:
The old object that matched key, or null.

get

public java.lang.Object get(java.lang.String key)
Get an object that matches the key.

Parameters:
key - must be a 7-bit ASCII string
Returns:
The object that matches the key, or null.

get2

public java.lang.Object get2(java.lang.String key)
Get an object that matches the key. This method is faster than get(), but is not thread-safe.

Parameters:
key - must be a 7-bit ASCII string
Returns:
The object that matches the key, or null.

getLongestKeyLength

public int getLongestKeyLength()
Get the length of the longest key used in the table.