Class StringTrieBuilder.ListBranchNode
java.lang.Object
com.ibm.icu.util.StringTrieBuilder.Node
com.ibm.icu.util.StringTrieBuilder.BranchNode
com.ibm.icu.util.StringTrieBuilder.ListBranchNode
- Enclosing class:
StringTrieBuilder
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate StringTrieBuilder.Node[]private intprivate char[]private int[]Fields inherited from class StringTrieBuilder.BranchNode
firstEdgeNumber, hashFields inherited from class StringTrieBuilder.Node
offset -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(int c, int value) voidadd(int c, StringTrieBuilder.Node node) booleaninthashCode()intmarkRightEdgesFirst(int edgeNumber) Traverses the Node graph and numbers branch edges, with rightmost edges first.voidwrite(StringTrieBuilder builder) Methods inherited from class StringTrieBuilder.Node
add, getOffset, register, writeUnlessInsideRightEdge
-
Field Details
-
equal
-
length
private int length -
values
private int[] values -
units
private char[] units
-
-
Constructor Details
-
ListBranchNode
public ListBranchNode(int capacity)
-
-
Method Details
-
equals
- Overrides:
equalsin classStringTrieBuilder.Node
-
hashCode
public int hashCode()- Overrides:
hashCodein classStringTrieBuilder.BranchNode
-
markRightEdgesFirst
public int markRightEdgesFirst(int edgeNumber) Description copied from class:StringTrieBuilder.NodeTraverses the Node graph and numbers branch edges, with rightmost edges first. This is to avoid writing a duplicate node twice. Branch nodes in this trie data structure are not symmetric. Most branch edges "jump" to other nodes but the rightmost branch edges just continue without a jump. Therefore, write() must write the rightmost branch edge last (trie units are written backwards), and must write it at that point even if it is a duplicate of a node previously written elsewhere. This function visits and marks right branch edges first. Edges are numbered with increasingly negative values because we share the offset field which gets positive values when nodes are written. A branch edge also remembers the first number for any of its edges. When a further-left branch edge has a number in the range of the rightmost edge's numbers, then it will be written as part of the required right edge and we can avoid writing it first. After root.markRightEdgesFirst(-1) the offsets of all nodes are negative edge numbers.- Overrides:
markRightEdgesFirstin classStringTrieBuilder.Node- Parameters:
edgeNumber- The first edge number for this node and its sub-nodes.- Returns:
- An edge number that is at least the maximum-negative of the input edge number and the numbers of this node and all of its sub-nodes.
-
write
- Specified by:
writein classStringTrieBuilder.Node
-
add
public void add(int c, int value) -
add
-