Class AbstractCodepointIterator
- java.lang.Object
-
- com.helger.commons.text.codepoint.AbstractCodepointIterator
-
- All Implemented Interfaces:
ICodepointIterator,Iterator<Codepoint>
- Direct Known Subclasses:
CodepointIteratorCharArray,CodepointIteratorCharBuffer,CodepointIteratorCharSequence
public abstract class AbstractCodepointIterator extends Object implements ICodepointIterator
Provides an iterator over Unicode Codepoints- Author:
- Apache Abdera, Philip Helger
-
-
Field Summary
Fields Modifier and Type Field Description protected intm_nLimitprotected intm_nPosition
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractCodepointIterator(int nPosition, int nLimit)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected 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 surrogateintlastPosition()intlimit()Codepointnext()char[]nextChars()Codepointpeek()Codepointpeek(int nIndex)char[]peekChars()intposition()voidposition(int n)Set the iterator positionintremaining()CodepointIteratorRestrictedrestrict(IntPredicate aFilter, boolean bScanning, boolean bInvert)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.helger.commons.text.codepoint.ICodepointIterator
hasNext, restrict, restrict
-
Methods inherited from interface java.util.Iterator
forEachRemaining, remove
-
-
-
-
Constructor Detail
-
AbstractCodepointIterator
protected AbstractCodepointIterator(@Nonnegative int nPosition, @Nonnegative int nLimit)
-
-
Method Detail
-
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
@CheckForSigned public int lastPosition()
- Specified by:
lastPositionin interfaceICodepointIterator- Returns:
- the final index position
-
nextChars
@Nullable public char[] 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
@Nullable public char[] 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
@Nonnull public Codepoint next()
- Specified by:
nextin interfaceICodepointIterator- Specified by:
nextin interfaceIterator<Codepoint>- Returns:
- the next codepoint
-
peek
@Nullable public Codepoint peek()
- Specified by:
peekin interfaceICodepointIterator- Returns:
- Peek the next codepoint
-
peek
@Nullable public Codepoint peek(int nIndex)
- Specified by:
peekin interfaceICodepointIterator- Parameters:
nIndex- index- Returns:
- Peek the specified codepoint
-
position
public void position(@Nonnegative int n)
Description copied from interface:ICodepointIteratorSet the iterator position- Specified by:
positionin interfaceICodepointIterator- Parameters:
n- new position
-
position
@Nonnegative public final int position()
- Specified by:
positionin interfaceICodepointIterator- Returns:
- the iterator position
-
limit
@Nonnegative public final int limit()
- Specified by:
limitin interfaceICodepointIterator- Returns:
- the iterator limit
-
remaining
@Nonnegative public int remaining()
- Specified by:
remainingin interfaceICodepointIterator- Returns:
- the remaining iterator size
-
isHigh
public boolean isHigh(@Nonnegative int index)
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
public boolean isLow(@Nonnegative int index)
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
-
-