This class is not intended for public subclassing.
| Modifier and Type | Class and Description |
|---|---|
| public static class | BytesTrie.Entry
Return value type for the Iterator. |
| public static class | BytesTrie.Iterator
Iterator for all of the (byte sequence, value) pairs in a BytesTrie. |
| public static enum | BytesTrie.Result
Return values for BytesTrie.next(), CharsTrie.next() and similar methods. |
| public static class | BytesTrie.State
BytesTrie state object, for saving a trie's current state and resetting the trie back to this state later. |
| Modifier and Type | Field and Description |
|---|---|
| private byte[] | |
| pack-priv static final int | |
| pack-priv static final int | |
| pack-priv static final int | |
| pack-priv static final int | |
| pack-priv static final int | |
| pack-priv static final int | |
| pack-priv static final int | |
| pack-priv static final int | |
| pack-priv static final int | |
| pack-priv static final int | |
| pack-priv static final int | |
| pack-priv static final int | |
| pack-priv static final int | |
| pack-priv static final int | |
| pack-priv static final int | |
| pack-priv static final int | |
| pack-priv static final int | |
| pack-priv static final int | |
| pack-priv static final int | |
| private static final int | |
| private int | |
| private int | |
| private int | |
| private static BytesTrie. |
| Access | Constructor and Description |
|---|---|
| public | BytesTrie(byte[]
Bytes array that contains the serialized trie. trieBytes, int Root offset of the trie in the array. offset)Constructs a BytesTrie reader instance. |
| public |
| Modifier and Type | Method and Description |
|---|---|
| private static void | |
| private BytesTrie. | |
| public BytesTrie | Returns: A shallow clone of this trie.Overrides java. |
| public BytesTrie. | Returns: The match/value Result.Determines whether the byte sequence so far matches, whether it has a value, and whether another input byte can continue a matching byte sequence. |
| private static long | |
| private static long | |
| public BytesTrie. | Returns: The match/value Result.Input byte value. Values -0x100..-1 are treated like 0..0xff.
Values below -0x100 and above 0xff will never match. inByte)Traverses the trie from the initial state for this input byte. |
| private static void | |
| public int | Returns: The number of bytes which continue the byte sequence from here.Each next byte is 0-extended to a char and appended to this object.
(Only uses the out.append(c) method.) out)Finds each byte which continues the byte sequence from the current state. |
| public long | |
| public long | Returns: The unique value in bits 32..1 with bit 0 set, if all byte sequences reachable from the current state map to the same value; otherwise returns 0.Determines whether all byte sequences reachable from the current state map to the same value, and if so, returns that value. |
| public int | Returns: The value for the byte sequence so far.Returns a matching byte sequence's value if called immediately after current()/first()/next() returned Result.INTERMEDIATE_VALUE or Result.FINAL_VALUE. |
| public BytesTrie. | Returns: A new BytesTrie.Iterator.Implements java. |
| public BytesTrie. | Returns: A new BytesTrie.Iterator.If 0, the iterator returns full strings/byte sequences.
Otherwise, the iterator returns strings with this maximum length. maxStringLength)Iterates from the current state of this trie. |
| public static BytesTrie. | Returns: A new BytesTrie.Iterator.Bytes array that contains the serialized trie. trieBytes, int Root offset of the trie in the array. offset, int If 0, the iterator returns full strings/byte sequences.
Otherwise, the iterator returns strings with this maximum length. maxStringLength)Iterates from the root of a byte-serialized BytesTrie. |
| public static int | jumpByDelta(byte[] bytes, int pos)
Deprecated
This API is ICU internal only.
Reads a jump delta and jumps.
|
| public BytesTrie. | Returns: The match/value Result.Input byte value. Values -0x100..-1 are treated like 0..0xff.
Values below -0x100 and above 0xff will never match. inByte)Traverses the trie from the current state for this input byte. |
| public BytesTrie. | Returns: The match/value Result.Contains a string or byte sequence. s, int The start index of the byte sequence in s. sIndex, int The (exclusive) end index of the byte sequence in s. sLimit)Traverses the trie from the current state for this byte sequence. |
| private BytesTrie. | |
| private static int | |
| public BytesTrie | |
| public BytesTrie | Returns: thisThe State object which holds a saved trie state. stateResets this trie to the saved state. |
| public BytesTrie | Returns: thisThe opaque trie state value from getState64(). state)Resets this trie to the saved state. |
| public BytesTrie | |
| private static int | |
| private static int | |
| private static int | |
| private void |
| bytes_ | back to summary |
|---|---|
| private byte[] bytes_ | |
| kFiveByteDeltaLead | back to summary |
|---|---|
| pack-priv static final int kFiveByteDeltaLead | |
| kFiveByteValueLead | back to summary |
|---|---|
| pack-priv static final int kFiveByteValueLead | |
| kFourByteDeltaLead | back to summary |
|---|---|
| pack-priv static final int kFourByteDeltaLead | |
| kFourByteValueLead | back to summary |
|---|---|
| pack-priv static final int kFourByteValueLead | |
| kMaxBranchLinearSubNodeLength | back to summary |
|---|---|
| pack-priv static final int kMaxBranchLinearSubNodeLength | |
| kMaxLinearMatchLength | back to summary |
|---|---|
| pack-priv static final int kMaxLinearMatchLength | |
| kMaxOneByteDelta | back to summary |
|---|---|
| pack-priv static final int kMaxOneByteDelta | |
| kMaxOneByteValue | back to summary |
|---|---|
| pack-priv static final int kMaxOneByteValue | |
| kMaxThreeByteDelta | back to summary |
|---|---|
| pack-priv static final int kMaxThreeByteDelta | |
| kMaxThreeByteValue | back to summary |
|---|---|
| pack-priv static final int kMaxThreeByteValue | |
| kMaxTwoByteDelta | back to summary |
|---|---|
| pack-priv static final int kMaxTwoByteDelta | |
| kMaxTwoByteValue | back to summary |
|---|---|
| pack-priv static final int kMaxTwoByteValue | |
| kMinLinearMatch | back to summary |
|---|---|
| pack-priv static final int kMinLinearMatch | |
| kMinOneByteValueLead | back to summary |
|---|---|
| pack-priv static final int kMinOneByteValueLead | |
| kMinThreeByteDeltaLead | back to summary |
|---|---|
| pack-priv static final int kMinThreeByteDeltaLead | |
| kMinThreeByteValueLead | back to summary |
|---|---|
| pack-priv static final int kMinThreeByteValueLead | |
| kMinTwoByteDeltaLead | back to summary |
|---|---|
| pack-priv static final int kMinTwoByteDeltaLead | |
| kMinTwoByteValueLead | back to summary |
|---|---|
| pack-priv static final int kMinTwoByteValueLead | |
| kMinValueLead | back to summary |
|---|---|
| pack-priv static final int kMinValueLead | |
| kValueIsFinal | back to summary |
|---|---|
| private static final int kValueIsFinal | |
| pos_ | back to summary |
|---|---|
| private int pos_ | |
| remainingMatchLength_ | back to summary |
|---|---|
| private int remainingMatchLength_ | |
| root_ | back to summary |
|---|---|
| private int root_ | |
| valueResults_ | back to summary |
|---|---|
| private static BytesTrie. | |
| BytesTrie | back to summary |
|---|---|
| public BytesTrie(byte[] trieBytes, int offset) Constructs a BytesTrie reader instance. The array must contain a copy of a byte sequence from the BytesTrieBuilder, with the offset indicating the first byte of that sequence. The BytesTrie object will not read more bytes than the BytesTrieBuilder generated in the corresponding build() call. The array is not copied/cloned and must not be modified while the BytesTrie object is in use.
| |
| BytesTrie | back to summary |
|---|---|
| public BytesTrie(BytesTrie other) Copy constructor. Makes a shallow copy of the other trie reader object and its state. Does not copy the byte array which will be shared. Same as clone() but without the throws clause.
| |
| append | back to summary |
|---|---|
| private static void append(Appendable out, int c) | |
| branchNext | back to summary |
|---|---|
| private BytesTrie. | |
| clone | back to summary |
|---|---|
| public BytesTrie clone() throws CloneNotSupportedException Overrides java. Clones this trie reader object and its state, but not the byte array which will be shared.
| |
| current | back to summary |
|---|---|
| public BytesTrie. Determines whether the byte sequence so far matches, whether it has a value, and whether another input byte can continue a matching byte sequence. | |
| findUniqueValue | back to summary |
|---|---|
| private static long findUniqueValue(byte[] bytes, int pos, long uniqueValue) | |
| findUniqueValueFromBranch | back to summary |
|---|---|
| private static long findUniqueValueFromBranch(byte[] bytes, int pos, int length, long uniqueValue) | |
| first | back to summary |
|---|---|
| public BytesTrie. Traverses the trie from the initial state for this input byte. Equivalent to reset().next(inByte). | |
| getNextBranchBytes | back to summary |
|---|---|
| private static void getNextBranchBytes(byte[] bytes, int pos, int length, Appendable out) | |
| getNextBytes | back to summary |
|---|---|
| public int getNextBytes(Appendable out) Finds each byte which continues the byte sequence from the current state. That is, each byte b for which it would be next(b)!=Result.NO_MATCH now.
| |
| getState64 | back to summary |
|---|---|
| public long getState64() Returns the state of this trie as a 64-bit integer. The state value is never 0.
| |
| getUniqueValue | back to summary |
|---|---|
| public long getUniqueValue() Determines whether all byte sequences reachable from the current state map to the same value, and if so, returns that value.
| |
| getValue | back to summary |
|---|---|
| public int getValue() Returns a matching byte sequence's value if called immediately after current()/first()/next() returned Result.INTERMEDIATE_VALUE or Result.FINAL_VALUE. getValue() can be called multiple times. Do not call getValue() after Result.NO_MATCH or Result.NO_VALUE!
| |
| iterator | back to summary |
|---|---|
| public BytesTrie. Implements java. Iterates from the current state of this trie. | |
| iterator | back to summary |
|---|---|
| public BytesTrie. Iterates from the current state of this trie. | |
| iterator | back to summary |
|---|---|
| public static BytesTrie. Iterates from the root of a byte-serialized BytesTrie.
| |
| jumpByDelta | back to summary |
|---|---|
| public static int jumpByDelta(byte[] bytes, int pos)
Deprecated This API is ICU internal only. Reads a jump delta and jumps.
| |
| next | back to summary |
|---|---|
| public BytesTrie. Traverses the trie from the current state for this input byte. | |
| next | back to summary |
|---|---|
| public BytesTrie. Traverses the trie from the current state for this byte sequence. Equivalent to Result result=current(); for(each c in s) if(!result.hasNext()) return Result.NO_MATCH; result=next(c); return result; | |
| nextImpl | back to summary |
|---|---|
| private BytesTrie. | |
| readValue | back to summary |
|---|---|
| private static int readValue(byte[] bytes, int pos, int leadByte) | |
| reset | back to summary |
|---|---|
| public BytesTrie reset() Resets this trie to its initial state. | |
| resetToState | back to summary |
|---|---|
| public BytesTrie resetToState(BytesTrie. Resets this trie to the saved state.
Slower than | |
| resetToState64 | back to summary |
|---|---|
| public BytesTrie resetToState64(long state) Resets this trie to the saved state.
Unlike
| |
| saveState | back to summary |
|---|---|
| public BytesTrie saveState(BytesTrie. Saves the state of this trie.
| |
| skipDelta | back to summary |
|---|---|
| private static int skipDelta(byte[] bytes, int pos) | |
| skipValue | back to summary |
|---|---|
| private static int skipValue(int pos, int leadByte) | |
| skipValue | back to summary |
|---|---|
| private static int skipValue(byte[] bytes, int pos) | |
| stop | back to summary |
|---|---|
| private void stop() | |
| Modifier and Type | Field and Description |
|---|---|
| private byte[] | |
| private int | |
| public int | value
The value associated with the byte sequence. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| private void | |
| private void | |
| public byte | Returns: The index-th byte sequence byte.An index into the byte sequence. index)Returns a byte of the byte sequence. |
| public ByteBuffer | |
| public int | |
| public void | copyBytesTo(byte[]
Destination byte array. dest, int Starting offset to where in dest the byte sequence is copied. destOffset)Copies the byte sequence into a byte array. |
| private void | |
| private void |
| bytes | back to summary |
|---|---|
| private byte[] bytes | |
| length | back to summary |
|---|---|
| private int length | |
| value | back to summary |
|---|---|
| public int value The value associated with the byte sequence.
| |
| Entry | back to summary |
|---|---|
| private Entry(int capacity) | |
| append | back to summary |
|---|---|
| private void append(byte b) | |
| append | back to summary |
|---|---|
| private void append(byte[] b, int off, int len) | |
| byteAt | back to summary |
|---|---|
| public byte byteAt(int index) Returns a byte of the byte sequence.
| |
| bytesAsByteBuffer | back to summary |
|---|---|
public ByteBuffer bytesAsByteBuffer()
| |
| bytesLength | back to summary |
|---|---|
public int bytesLength()
| |
| copyBytesTo | back to summary |
|---|---|
| public void copyBytesTo(byte[] dest, int destOffset) Copies the byte sequence into a byte array.
| |
| ensureCapacity | back to summary |
|---|---|
| private void ensureCapacity(int len) | |
| truncateString | back to summary |
|---|---|
| private void truncateString(int newLength) | |
| Modifier and Type | Field and Description |
|---|---|
| private byte[] | |
| private BytesTrie. | |
| private int | |
| private int | |
| private int | |
| private int | |
| private int | |
| private ArrayList |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| private int | |
| public boolean | Returns: true if there are more elements.Implements java. true if the iteration has more elements.
|
| public BytesTrie. | Returns: An Entry with the string and value of the next element.Implements java. |
| public void | |
| public BytesTrie. | |
| private BytesTrie. |
| bytes_ | back to summary |
|---|---|
| private byte[] bytes_ | |
| entry_ | back to summary |
|---|---|
| private BytesTrie. | |
| initialPos_ | back to summary |
|---|---|
| private int initialPos_ | |
| initialRemainingMatchLength_ | back to summary |
|---|---|
| private int initialRemainingMatchLength_ | |
| maxLength_ | back to summary |
|---|---|
| private int maxLength_ | |
| pos_ | back to summary |
|---|---|
| private int pos_ | |
| remainingMatchLength_ | back to summary |
|---|---|
| private int remainingMatchLength_ | |
| stack_ | back to summary |
|---|---|
| private ArrayList<Long> stack_ | |
| Iterator | back to summary |
|---|---|
| private Iterator(byte[] trieBytes, int offset, int remainingMatchLength, int maxStringLength) | |
| branchNext | back to summary |
|---|---|
| private int branchNext(int pos, int length) | |
| hasNext | back to summary |
|---|---|
| public boolean hasNext() Implements java. Doc from java. Returns | |
| next | back to summary |
|---|---|
| public BytesTrie. Implements java. Finds the next (byte sequence, value) pair if there is one. If the byte sequence is truncated to the maximum length and does not have a real value, then the value is set to -1. In this case, this "not a real value" is indistinguishable from a real value of -1.
| |
| remove | back to summary |
|---|---|
| public void remove() Overrides default java. Iterator.remove() is not supported.
| |
| reset | back to summary |
|---|---|
| public BytesTrie. Resets this iterator to its initial state. | |
| truncateAndStop | back to summary |
|---|---|
| private BytesTrie. | |
| Modifier and Type | Field and Description |
|---|---|
| public static final BytesTrie. | FINAL_VALUE
The input unit(s) continued a matching string and there is a value for the string so far. |
| public static final BytesTrie. | INTERMEDIATE_VALUE
The input unit(s) continued a matching string and there is a value for the string so far. |
| public static final BytesTrie. | NO_MATCH
The input unit(s) did not continue a matching string. |
| public static final BytesTrie. | NO_VALUE
The input unit(s) continued a matching string but there is no value for the string so far. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | Returns: true if another input byte/unit can continue a matching string.Equivalent to (result==NO_VALUE || result==INTERMEDIATE_VALUE). |
| public boolean | Returns: true if there is a value for the input bytes/units so far.Equivalent to (result==INTERMEDIATE_VALUE || result==FINAL_VALUE). |
| public boolean | Returns: true if the input bytes/units so far are part of a matching string/byte sequence.Same as (result!=NO_MATCH). |
| public static BytesTrie. | |
| public static BytesTrie. |
| FINAL_VALUE | back to summary |
|---|---|
| public static final BytesTrie. The input unit(s) continued a matching string and there is a value for the string so far. This value will be returned by getValue(). No further input byte/unit can continue a matching string.
| |
| INTERMEDIATE_VALUE | back to summary |
|---|---|
| public static final BytesTrie. The input unit(s) continued a matching string and there is a value for the string so far. This value will be returned by getValue(). Another input byte/unit can continue a matching string.
| |
| NO_MATCH | back to summary |
|---|---|
| public static final BytesTrie. The input unit(s) did not continue a matching string. Once current()/next() return NO_MATCH, all further calls to current()/next() will also return NO_MATCH, until the trie is reset to its original state or to a saved state.
| |
| NO_VALUE | back to summary |
|---|---|
| public static final BytesTrie. The input unit(s) continued a matching string but there is no value for the string so far. (It is a prefix of a longer string.)
| |
| Result | back to summary |
|---|---|
| private Result() | |
| hasNext | back to summary |
|---|---|
| public boolean hasNext() Equivalent to (result==NO_VALUE || result==INTERMEDIATE_VALUE).
| |
| hasValue | back to summary |
|---|---|
| public boolean hasValue() Equivalent to (result==INTERMEDIATE_VALUE || result==FINAL_VALUE). | |
| matches | back to summary |
|---|---|
| public boolean matches() Same as (result!=NO_MATCH).
| |
| valueOf | back to summary |
|---|---|
| public static BytesTrie. | |
| values | back to summary |
|---|---|
| public static BytesTrie. | |
| Modifier and Type | Field and Description |
|---|---|
| private byte[] | |
| private int | |
| private int | |
| private int |
| Access | Constructor and Description |
|---|---|
| public |
| bytes | back to summary |
|---|---|
| private byte[] bytes | |
| pos | back to summary |
|---|---|
| private int pos | |
| remainingMatchLength | back to summary |
|---|---|
| private int remainingMatchLength | |
| root | back to summary |
|---|---|
| private int root | |
| State | back to summary |
|---|---|
| public State() Constructs an empty State.
| |