public class TrieNode extends java.lang.Object
Constructor and Description |
---|
TrieNode(char character,
TrieNode parent)
Constructs a trie node
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj) |
char |
getCharacter()
Returns the character of the trie node
|
TrieNode |
getChild(char c)
Returns the child node that corresponds to the character
|
java.lang.Integer |
getEntry(TrieSymbolTable table)
Returns the entry of the symbol table 'table'
|
TrieNode |
getOrAddChild(boolean isWord,
char c,
TrieSymbolTable table,
int code)
Adds and/or retrieve a child trie node.
|
TrieNode |
getParent()
Returns the parent node
|
int |
hashCode() |
java.lang.String |
toString() |
public TrieNode getOrAddChild(boolean isWord, char c, TrieSymbolTable table, int code) throws SymbolException
isWord
- true if it is a word (entry), otherwise falsec
- the character to the child nodetable
- which symbol table to look in or add tocode
- the integer representation of the string valueSymbolException
public TrieNode getChild(char c)
c
- the character of the child nodepublic java.lang.Integer getEntry(TrieSymbolTable table)
table
- which symbol tablepublic char getCharacter()
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
Copyright 2007-2017 Johan Hall, Jens Nilsson and Joakim Nivre.