edu.iastate.jtm.dic
Interface TrieNode

All Known Implementing Classes:
AbstractTrieNode, AsciiTrieNode, DigitTrieNode, FuzzyTrieNode, LetterDigitTrieNode, LetterTrieNode, LowerTrieNode, WordTrieNode

public interface TrieNode

Define the behaviors of a node in a trie.

Author:
Jing Ding

Method Summary
 int compareKey(java.lang.CharSequence aKey)
          Compare a string to this node's key.
 TrieNode createChild(int index)
          Create a new child node at the specified array index.
 TrieNode[] createChildren()
          Allocate memory for a node's child node array.
 TrieNode[] getChildren()
          Return a node's child node array.
 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.
 int getIndex(char[] key)
           
 int getIndex(java.lang.CharSequence key)
           
 char[] getKey()
          Return a node's key.
 java.lang.String getKeyString()
           
 TrieNode getParent()
           
 java.lang.Object getValue()
          Return a node's attached value.
 boolean isCaseSensitive()
           
 void printIndexMapping()
           
 void removeChild(int index)
           
 void removeChildren()
           
 void setKey(char[] k)
          Set a node's key.
 void setParent(TrieNode parent)
           
 void setValue(java.lang.Object obj)
          Attach a value to the node.
 java.lang.String supportedCharacters()
          Return supported characters by this TrieNode.
 

Method Detail

getIndex

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

Parameters:
c - the character of interest.
Returns:
index of the character. -1 if character not supported.

getIndex

int getIndex(char[] key)

getIndex

int getIndex(java.lang.CharSequence key)

getDegree

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

Returns:
the size of alphabet.

getValue

java.lang.Object getValue()
Return a node's attached value.

Returns:
the value attached to the node.

setValue

void setValue(java.lang.Object obj)
Attach a value to the node.

Parameters:
obj - the value.

getKey

char[] getKey()
Return a node's key.

Returns:
the key of the node.

getKeyString

java.lang.String getKeyString()

setKey

void setKey(char[] k)
Set a node's key.

Parameters:
k - the key.

getChildren

TrieNode[] getChildren()
Return a node's child node array.

Returns:
The child node array of the node.

getParent

TrieNode getParent()

setParent

void setParent(TrieNode parent)

createChildren

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

Returns:
Newly allocated array.

createChild

TrieNode createChild(int index)
Create a new child node at the specified array index.

Parameters:
index - the position in the array for the child node.
Returns:
The newly created child node.

removeChild

void removeChild(int index)

removeChildren

void removeChildren()

compareKey

int compareKey(java.lang.CharSequence aKey)
Compare a string to this node's key.

Parameters:
aKey - the string to be compared.
Returns:
 = 0, complete match;
 > 0, the string is a superset of the key;
 < 0, matched portion is a subset of the key.
 The absolute value of the return value is the number of characters matched, if return != 0.
 

supportedCharacters

java.lang.String supportedCharacters()
Return supported characters by this TrieNode.

Returns:
supported characters by this TrieNode.

printIndexMapping

void printIndexMapping()

isCaseSensitive

boolean isCaseSensitive()