edu.iastate.jtm.dic
Class LetterTrieNode

java.lang.Object
  extended by edu.iastate.jtm.dic.AbstractTrieNode
      extended by edu.iastate.jtm.dic.LetterTrieNode
All Implemented Interfaces:
TrieNode

public class LetterTrieNode
extends AbstractTrieNode

A trie supporting letters (upper and lower case).

Author:
Jing Ding

Field Summary
 
Fields inherited from class edu.iastate.jtm.dic.AbstractTrieNode
children, parent
 
Constructor Summary
LetterTrieNode()
           
 
Method Summary
 TrieNode[] createChildren()
          Allocate memory for a node's child node array.
protected  TrieNode createNodeInstance()
          Create a new child node at the specified array index.
 int getDegree()
          Return the degree of this trie (size of the trie's alphabet).
 int getIndex(char c)
          Return the index of a character in this node's child array.
 
Methods inherited from class edu.iastate.jtm.dic.AbstractTrieNode
compareKey, createChild, getChildren, getIndex, getIndex, getKey, getKeyString, getParent, getValue, isCaseSensitive, printIndexMapping, removeChild, removeChildren, setKey, setParent, setValue, supportedCharacters
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LetterTrieNode

public LetterTrieNode()
Method Detail

createNodeInstance

protected TrieNode createNodeInstance()
Create a new child node at the specified array index.

Specified by:
createNodeInstance in class AbstractTrieNode
Parameters:
id - the position in the array for the child node.
Returns:
The newly created child node.

createChildren

public TrieNode[] createChildren()
Allocate memory for a node's child node array.

Specified by:
createChildren in interface TrieNode
Specified by:
createChildren in class AbstractTrieNode
Returns:
Newly allocated array.

getDegree

public int getDegree()
Return the degree of this trie (size of the trie's alphabet).

Specified by:
getDegree in interface TrieNode
Specified by:
getDegree in class AbstractTrieNode
Returns:
the size of alphabet (26).

getIndex

public int getIndex(char c)
Return the index of a character in this node's child array.

Specified by:
getIndex in interface TrieNode
Specified by:
getIndex in class AbstractTrieNode
Parameters:
c - the character of interest.
Returns:
index of the character.