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

public abstract Class CodePointTrie

extends CodePointMap
Class Inheritance
Known Direct Subclasses
com.ibm.icu.util.CodePointTrie.Fast, com.ibm.icu.util.CodePointTrie.Small
Imports
java.io.DataOutputStream, .IOException, .OutputStream, java.nio.ByteBuffer, .ByteOrder, com.ibm.icu.impl.ICUBinary, .Normalizer2Impl.UTF16Plus

Immutable Unicode code point trie. Fast, reasonably compact, map from Unicode code points (U+0000..U+10FFFF) to integer values. For details see https://icu.unicode.org/design/struct/utrie

This class is not intended for public subclassing.

ICU Status
Stable since ICU 63.
See Also
MutableCodePointTrie

Nested and Inner Type Summary

Modifier and TypeClass and Description
private abstract static class
private static class
private static class
private static class
public abstract static class
CodePointTrie.Fast

A CodePointTrie with Type#FAST.

public static class
public static class
public static class
public abstract static class
CodePointTrie.Small

A CodePointTrie with Type#SMALL.

public static class
public static class
public static class
public static enum
CodePointTrie.Type

Selectors for the type of a CodePointTrie.

public static enum
CodePointTrie.ValueWidth

Selectors for the number of bits in a CodePointTrie data value.

Field Summary

Modifier and TypeField and Description
private final int[]
private static final int
private static final int
BMP_INDEX_LENGTH

The length of the BMP index table.

pack-priv static final int
CP_PER_INDEX_2_ENTRY

Number of code points per index-2 table entry.

protected final CodePointTrie.Data
data

Deprecated This API is ICU internal only.
protected final int
dataLength

Deprecated This API is ICU internal only.
private final int
dataNullOffset

Internal data null block offset, not shifted.

private static final int
ERROR_VALUE_NEG_DATA_OFFSET

Offset from dataLength (to be subtracted) for fetching the value returned for out-of-range code points and ill-formed UTF-8/16.

pack-priv static final int
FAST_DATA_BLOCK_LENGTH

Number of entries in a data block for code points below the fast limit.

private static final int
FAST_DATA_MASK

Mask for getting the lower bits for the in-fast-data-block offset.

pack-priv static final int
private static final int
HIGH_VALUE_NEG_DATA_OFFSET

Offset from dataLength (to be subtracted) for fetching the value returned for code points highStart..U+10FFFF.

protected final int
highStart

Start of the last range which ends at U+10FFFF.

private final char[]
private final int
index3NullOffset

Internal index-3 null block offset.

pack-priv static final int
INDEX_2_BLOCK_LENGTH

Number of entries in an index-2 block.

pack-priv static final int
INDEX_2_MASK

Mask for getting the lower bits for the in-index-2-block offset.

pack-priv static final int
INDEX_3_BLOCK_LENGTH

Number of entries in an index-3 block.

private static final int
INDEX_3_MASK

Mask for getting the lower bits for the in-index-3-block offset.

private static final int
pack-priv static final int
pack-priv static final int
NO_INDEX3_NULL_OFFSET

Value for index3NullOffset which indicates that there is no index-3 null block.

private final int
private static final int
OMITTED_BMP_INDEX_1_LENGTH

Number of index-1 entries for the BMP.

private static final int
private static final int
private static final int
private static final int
private static final int
SHIFT_1

Shift size for getting the index-1 table offset.

pack-priv static final int
SHIFT_1_2

Difference between two shift sizes, for getting an index-1 offset from an index-2 offset.

private static final int
SHIFT_2

Shift size for getting the index-2 table offset.

pack-priv static final int
SHIFT_2_3

Difference between two shift sizes, for getting an index-2 offset from an index-3 offset.

pack-priv static final int
SHIFT_3

Shift size for getting the index-3 table offset.

pack-priv static final int
SMALL_DATA_BLOCK_LENGTH

Number of entries in a small data block.

pack-priv static final int
SMALL_DATA_MASK

Mask for getting the lower bits for the in-small-data-block offset.

private static final int
pack-priv static final int
private static final int

Constructor Summary

AccessConstructor and Description
private
CodePointTrie(char[] index, CodePointTrie.Data data, int highStart, int index3NullOffset, int dataNullOffset)

Method Summary

Modifier and TypeMethod and Description
public final int

Returns:

The ASCII code point's trie value.
asciiGet
(int
the input code point; must be U+0000..U+007F
c
)

Returns a trie value for an ASCII code point, without range checking.

protected abstract int
cpIndex(int c)

Deprecated This API is ICU internal only.
protected final int
fastIndex(int c)

Deprecated This API is ICU internal only.
public static CodePointTrie

Returns:

the trie
fromBinary
(CodePointTrie.Type
selects the trie type; this method throws an exception if the type does not match the binary data; use null to accept any type
type
,
CodePointTrie.ValueWidth
selects the number of bits in a data value; this method throws an exception if the valueWidth does not match the binary data; use null to accept any data value width
valueWidth
,
ByteBuffer
a buffer containing the binary data of a CodePointTrie
bytes
)

Creates a trie from its binary form, stored in the ByteBuffer starting at the current position.

public int
get(int
the code point
c
)

Implements abstract com.ibm.icu.util.CodePointMap.get.

Returns the value for a code point as stored in the map, with range checking.
public final boolean
getRange(int
range start
start
,
CodePointMap.ValueFilter
an object that may modify the map data value, or null if the values from the map are to be used unmodified
filter
,
CodePointMap.Range
the range object that will be set to the code point range and value
range
)

Implements abstract com.ibm.icu.util.CodePointMap.getRange.

Sets the range object to a range of code points beginning with the start parameter.
public abstract CodePointTrie.Type

Returns:

the trie type
getType
()

Returns the trie type.

public final CodePointTrie.ValueWidth

Returns:

the number of bits in a trie data value
getValueWidth
()

Returns the number of bits in a trie data value.

private final int
private static final int
maybeFilterValue(int value, int trieNullValue, int nullValue, CodePointMap.ValueFilter filter)

protected final int
smallIndex(CodePointTrie.Type type, int c)

Deprecated This API is ICU internal only.
public final int

Returns:

the number of bytes written
toBinary
(OutputStream
the output stream
os
)

Writes a representation of the trie to the output stream.

Inherited from com.ibm.icu.util.CodePointMap:
getRangeiteratorstringIterator