Package com.ibm.icu.util
Class BytesTrie.Iterator
- java.lang.Object
-
- com.ibm.icu.util.BytesTrie.Iterator
-
- All Implemented Interfaces:
java.util.Iterator<BytesTrie.Entry>
- Enclosing class:
- BytesTrie
public static final class BytesTrie.Iterator extends java.lang.Object implements java.util.Iterator<BytesTrie.Entry>
Iterator for all of the (byte sequence, value) pairs in a BytesTrie.
-
-
Field Summary
Fields Modifier and Type Field Description private byte[]
bytes_
private BytesTrie.Entry
entry_
private int
initialPos_
private int
initialRemainingMatchLength_
private int
maxLength_
private int
pos_
private int
remainingMatchLength_
private java.util.ArrayList<java.lang.Long>
stack_
-
Constructor Summary
Constructors Modifier Constructor Description private
Iterator(byte[] trieBytes, int offset, int remainingMatchLength, int maxStringLength)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private int
branchNext(int pos, int length)
boolean
hasNext()
BytesTrie.Entry
next()
Finds the next (byte sequence, value) pair if there is one.void
remove()
Iterator.remove() is not supported.BytesTrie.Iterator
reset()
Resets this iterator to its initial state.private BytesTrie.Entry
truncateAndStop()
-
-
-
Field Detail
-
bytes_
private byte[] bytes_
-
pos_
private int pos_
-
initialPos_
private int initialPos_
-
remainingMatchLength_
private int remainingMatchLength_
-
initialRemainingMatchLength_
private int initialRemainingMatchLength_
-
maxLength_
private int maxLength_
-
entry_
private BytesTrie.Entry entry_
-
stack_
private java.util.ArrayList<java.lang.Long> stack_
-
-
Method Detail
-
reset
public BytesTrie.Iterator reset()
Resets this iterator to its initial state.- Returns:
- this
-
hasNext
public boolean hasNext()
- Specified by:
hasNext
in interfacejava.util.Iterator<BytesTrie.Entry>
- Returns:
- true if there are more elements.
-
next
public BytesTrie.Entry next()
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.- Specified by:
next
in interfacejava.util.Iterator<BytesTrie.Entry>
- Returns:
- An Entry with the string and value of the next element.
- Throws:
java.util.NoSuchElementException
- - iteration has no more elements.
-
remove
public void remove()
Iterator.remove() is not supported.- Specified by:
remove
in interfacejava.util.Iterator<BytesTrie.Entry>
- Throws:
java.lang.UnsupportedOperationException
- (always)
-
truncateAndStop
private BytesTrie.Entry truncateAndStop()
-
branchNext
private int branchNext(int pos, int length)
-
-