Class CharTrieNode
- java.lang.Object
-
- ch.randelshofer.fastdoubleparser.chr.CharTrieNode
-
final class CharTrieNode extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description private char[]charsprivate CharTrieNode[]childrenprivate booleanisEnd
-
Constructor Summary
Constructors Constructor Description CharTrieNode()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CharTrieNodeget(char ch)Gets the child not for the given character, if it exists.private intindexOf(char ch)Returns the index of the specified character in this node.CharTrieNodeinsert(char ch)Insert a character into this node if it does not already exist.CharTrieNodeinsert(char ch, CharTrieNode forcedNode)Insert a character into this node if it does not already exist.booleanisEnd()voidsetEnd()
-
-
-
Field Detail
-
chars
private char[] chars
-
children
private CharTrieNode[] children
-
isEnd
private boolean isEnd
-
-
Method Detail
-
insert
public CharTrieNode insert(char ch)
Insert a character into this node if it does not already exist. Returns the child node corresponding to the char.- Parameters:
ch- the character- Returns:
- the child node corresponding to the char
-
get
public CharTrieNode get(char ch)
Gets the child not for the given character, if it exists.- Parameters:
ch- the character- Returns:
- the child node corresponding to the char, or the sentinel node
-
indexOf
private int indexOf(char ch)
Returns the index of the specified character in this node.- Parameters:
ch- the character- Returns:
- the index or -1
-
setEnd
public void setEnd()
-
isEnd
public boolean isEnd()
-
insert
public CharTrieNode insert(char ch, CharTrieNode forcedNode)
Insert a character into this node if it does not already exist. Forces the node 'forceNode' to be inserted.- Parameters:
ch- the characterforcedNode- the forced node- Returns:
- the forced node
-
-