Class AbstractCodepointIterator
java.lang.Object
com.helger.commons.text.codepoint.AbstractCodepointIterator
- All Implemented Interfaces:
ICodepointIterator,Iterator<Codepoint>
- Direct Known Subclasses:
CodepointIteratorCharArray,CodepointIteratorCharBuffer,CodepointIteratorCharSequence
Provides an iterator over Unicode Codepoints
- Author:
- Apache Abdera, Philip Helger
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract charget()protected abstract charget(int nIndex) booleanisHigh(int index) Returns true if the char at the specified index is a high surrogatebooleanisLow(int index) Returns true if the char at the specified index is a low surrogateintfinal intlimit()next()char[]peek()peek(int nIndex) char[]final intposition()voidposition(int n) Set the iterator positionintrestrict(IntPredicate aFilter, boolean bScanning, boolean bInvert) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.helger.commons.text.codepoint.ICodepointIterator
hasNext, restrict, restrictMethods inherited from interface java.util.Iterator
forEachRemaining, remove
-
Field Details
-
m_nPosition
protected int m_nPosition -
m_nLimit
protected int m_nLimit
-
-
Constructor Details
-
AbstractCodepointIterator
-
-
Method Details
-
get
protected abstract char get()- Returns:
- Get the next char
-
get
protected abstract char get(int nIndex) - Parameters:
nIndex- Index to be retrieved- Returns:
- Get the specified char
-
lastPosition
- Specified by:
lastPositionin interfaceICodepointIterator- Returns:
- the final index position
-
nextChars
- Specified by:
nextCharsin interfaceICodepointIterator- Returns:
- the next chars. If the codepoint is not supplemental, the char array will have a single member. If the codepoint is supplemental, the char array will have two members, representing the high and low surrogate chars
-
peekChars
- Specified by:
peekCharsin interfaceICodepointIterator- Returns:
- Peek the next chars in the iterator. If the codepoint is not supplemental, the char array will have a single member. If the codepoint is supplemental, the char array will have two members, representing the high and low surrogate chars
-
next
- Specified by:
nextin interfaceICodepointIterator- Specified by:
nextin interfaceIterator<Codepoint>- Returns:
- the next codepoint
-
peek
- Specified by:
peekin interfaceICodepointIterator- Returns:
- Peek the next codepoint
-
peek
- Specified by:
peekin interfaceICodepointIterator- Parameters:
nIndex- index- Returns:
- Peek the specified codepoint
-
position
Description copied from interface:ICodepointIteratorSet the iterator position- Specified by:
positionin interfaceICodepointIterator- Parameters:
n- new position
-
position
- Specified by:
positionin interfaceICodepointIterator- Returns:
- the iterator position
-
limit
- Specified by:
limitin interfaceICodepointIterator- Returns:
- the iterator limit
-
remaining
- Specified by:
remainingin interfaceICodepointIterator- Returns:
- the remaining iterator size
-
isHigh
Returns true if the char at the specified index is a high surrogate- Specified by:
isHighin interfaceICodepointIterator- Parameters:
index- index- Returns:
trueif the char at the specified index is a high surrogate
-
isLow
Returns true if the char at the specified index is a low surrogate- Specified by:
isLowin interfaceICodepointIterator- Parameters:
index- index- Returns:
trueif the char at the specified index is a low surrogate
-
restrict
@Nonnull public CodepointIteratorRestricted restrict(@Nonnull IntPredicate aFilter, boolean bScanning, boolean bInvert) - Specified by:
restrictin interfaceICodepointIterator
-