Top Description Fields Constructors Methods
com.ibm.icu.util

public final Class CharsTrieBuilder

extends StringTrieBuilder
Class Inheritance
Imports
java.nio.CharBuffer

Builder class for CharsTrie.

This class is not intended for public subclassing.

Author
Markus W. Scherer
ICU Status
Stable since ICU 4.8.

Field Summary

Modifier and TypeField and Description
private char[]
private int
private final char[]
Inherited from com.ibm.icu.util.StringTrieBuilder:
strings

Constructor Summary

AccessConstructor and Description
public
CharsTrieBuilder()

Constructs an empty builder.

Method Summary

Modifier and TypeMethod and Description
public CharsTrieBuilder

Returns:

this
add
(CharSequence
The input string.
s
,
int
The value associated with this char sequence.
value
)

Adds a (string, value) pair.

public CharsTrie

Returns:

A new CharsTrie for the add()ed data.
build
(StringTrieBuilder.Option
Build option, see StringTrieBuilder.Option.
buildOption
)

Builds a CharsTrie for the add()ed data.

private void
public CharSequence

Returns:

A CharSequence with the char-serialized CharsTrie for the add()ed data.
buildCharSequence
(StringTrieBuilder.Option
Build option, see StringTrieBuilder.Option.
buildOption
)

Builds a CharsTrie for the add()ed data and char-serializes it.

public CharsTrieBuilder

Returns:

this
clear
()

Removes all (string, value) pairs.

private void
ensureCapacity(int length)

protected int
getMaxBranchLinearSubNodeLength()

Implements abstract com.ibm.icu.util.StringTrieBuilder.getMaxBranchLinearSubNodeLength.

Deprecated This API is ICU internal only.
protected int
getMaxLinearMatchLength()

Implements abstract com.ibm.icu.util.StringTrieBuilder.getMaxLinearMatchLength.

Deprecated This API is ICU internal only.
protected int
getMinLinearMatch()

Implements abstract com.ibm.icu.util.StringTrieBuilder.getMinLinearMatch.

Deprecated This API is ICU internal only.
protected boolean
matchNodesCanHaveValues()

Implements abstract com.ibm.icu.util.StringTrieBuilder.matchNodesCanHaveValues.

Deprecated This API is ICU internal only.
protected int
write(int unit)

Implements abstract com.ibm.icu.util.StringTrieBuilder.write.

Deprecated This API is ICU internal only.
protected int
write(int offset, int length)

Implements abstract com.ibm.icu.util.StringTrieBuilder.write.

Deprecated This API is ICU internal only.
private int
write(char[] s, int length)

protected int
writeDeltaTo(int jumpTarget)

Implements abstract com.ibm.icu.util.StringTrieBuilder.writeDeltaTo.

Deprecated This API is ICU internal only.
protected int
writeValueAndFinal(int i, boolean isFinal)

Implements abstract com.ibm.icu.util.StringTrieBuilder.writeValueAndFinal.

Deprecated This API is ICU internal only.
protected int
writeValueAndType(boolean hasValue, int value, int node)

Implements abstract com.ibm.icu.util.StringTrieBuilder.writeValueAndType.

Deprecated This API is ICU internal only.
Inherited from com.ibm.icu.util.StringTrieBuilder:
addImplbuildImplclearImpl

Field Detail

charsback to summary
private char[] chars
charsLengthback to summary
private int charsLength
intUnitsback to summary
private final char[] intUnits

Constructor Detail

CharsTrieBuilderback to summary
public CharsTrieBuilder()

Constructs an empty builder.

ICU Status
Stable since ICU 4.8.

Method Detail

addback to summary
public CharsTrieBuilder add(CharSequence s, int value)

Adds a (string, value) pair. The string must be unique. The string contents will be copied; the builder does not keep a reference to the input CharSequence.

Parameters
s:CharSequence

The input string.

value:int

The value associated with this char sequence.

Returns:CharsTrieBuilder

this

ICU Status
Stable since ICU 4.8.
buildback to summary
public CharsTrie build(StringTrieBuilder.Option buildOption)

Builds a CharsTrie for the add()ed data. Once built, no further data can be add()ed until clear() is called.

A CharsTrie cannot be empty. At least one (string, value) pair must have been add()ed.

Multiple calls to build() or buildCharSequence() return tries or sequences which share the builder's char array, without rebuilding. After clear() has been called, a new array will be used.

Parameters
buildOption:StringTrieBuilder.Option

Build option, see StringTrieBuilder.Option.

Returns:CharsTrie

A new CharsTrie for the add()ed data.

ICU Status
Stable since ICU 4.8.
buildCharsback to summary
private void buildChars(StringTrieBuilder.Option buildOption)
buildCharSequenceback to summary
public CharSequence buildCharSequence(StringTrieBuilder.Option buildOption)

Builds a CharsTrie for the add()ed data and char-serializes it. Once built, no further data can be add()ed until clear() is called.

A CharsTrie cannot be empty. At least one (string, value) pair must have been add()ed.

Multiple calls to build() or buildCharSequence() return tries or sequences which share the builder's char array, without rebuilding. After clear() has been called, a new array will be used.

Parameters
buildOption:StringTrieBuilder.Option

Build option, see StringTrieBuilder.Option.

Returns:CharSequence

A CharSequence with the char-serialized CharsTrie for the add()ed data.

ICU Status
Stable since ICU 4.8.
clearback to summary
public CharsTrieBuilder clear()

Removes all (string, value) pairs. New data can then be add()ed and a new trie can be built.

Returns:CharsTrieBuilder

this

ICU Status
Stable since ICU 4.8.
ensureCapacityback to summary
private void ensureCapacity(int length)
getMaxBranchLinearSubNodeLengthback to summary
protected int getMaxBranchLinearSubNodeLength()

Implements abstract com.ibm.icu.util.StringTrieBuilder.getMaxBranchLinearSubNodeLength.

Deprecated

This API is ICU internal only.

Annotations
@Deprecated
@Override
ICU Status
Internal ICU component.
getMaxLinearMatchLengthback to summary
protected int getMaxLinearMatchLength()

Implements abstract com.ibm.icu.util.StringTrieBuilder.getMaxLinearMatchLength.

Deprecated

This API is ICU internal only.

Annotations
@Deprecated
@Override
ICU Status
Internal ICU component.
getMinLinearMatchback to summary
protected int getMinLinearMatch()

Implements abstract com.ibm.icu.util.StringTrieBuilder.getMinLinearMatch.

Deprecated

This API is ICU internal only.

Annotations
@Deprecated
@Override
ICU Status
Internal ICU component.
matchNodesCanHaveValuesback to summary
protected boolean matchNodesCanHaveValues()

Implements abstract com.ibm.icu.util.StringTrieBuilder.matchNodesCanHaveValues.

Deprecated

This API is ICU internal only.

Annotations
@Deprecated
@Override
ICU Status
Internal ICU component.
writeback to summary
protected int write(int unit)

Implements abstract com.ibm.icu.util.StringTrieBuilder.write.

Deprecated

This API is ICU internal only.

Annotations
@Deprecated
@Override
ICU Status
Internal ICU component.
writeback to summary
protected int write(int offset, int length)

Implements abstract com.ibm.icu.util.StringTrieBuilder.write.

Deprecated

This API is ICU internal only.

Annotations
@Deprecated
@Override
ICU Status
Internal ICU component.
writeback to summary
private int write(char[] s, int length)
writeDeltaToback to summary
protected int writeDeltaTo(int jumpTarget)

Implements abstract com.ibm.icu.util.StringTrieBuilder.writeDeltaTo.

Deprecated

This API is ICU internal only.

Annotations
@Deprecated
@Override
ICU Status
Internal ICU component.
writeValueAndFinalback to summary
protected int writeValueAndFinal(int i, boolean isFinal)

Implements abstract com.ibm.icu.util.StringTrieBuilder.writeValueAndFinal.

Deprecated

This API is ICU internal only.

Annotations
@Deprecated
@Override
ICU Status
Internal ICU component.
writeValueAndTypeback to summary
protected int writeValueAndType(boolean hasValue, int value, int node)

Implements abstract com.ibm.icu.util.StringTrieBuilder.writeValueAndType.

Deprecated

This API is ICU internal only.

Annotations
@Deprecated
@Override
ICU Status
Internal ICU component.