Package net.sf.xslthl
Class CharIter
- java.lang.Object
-
- net.sf.xslthl.CharIter
-
- All Implemented Interfaces:
java.lang.Iterable<java.lang.Character>
,java.util.Iterator<java.lang.Character>
public class CharIter extends java.lang.Object implements java.lang.Iterable<java.lang.Character>, java.util.Iterator<java.lang.Character>
A special character iterator
-
-
Constructor Summary
Constructors Constructor Description CharIter(java.lang.String input)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.regex.Matcher
createMatcher(java.util.regex.Pattern pattern)
Create a pattern matcherjava.lang.Character
current()
boolean
finished()
int
getLength()
int
getMark()
java.lang.String
getMarked()
int
getPosition()
boolean
hasNext()
int
indexOf(java.lang.String substr)
boolean
isMarked()
java.util.Iterator<java.lang.Character>
iterator()
Block
markedToBlock()
Block
markedToStyledBlock(java.lang.String styleName)
Create a style block, unless the stylename is equale to "none"void
moveNext()
Increase the pointervoid
moveNext(int offset)
Increase the point with the given offsetvoid
moveNextAndMark()
Increase the pointer and mark the position after itvoid
moveToEnd()
Move to the end of the stringjava.lang.Character
next()
java.lang.Character
next(int offset)
java.lang.Character
prev()
java.lang.Character
prev(int offset)
int
remaining()
void
remove()
void
setMark()
Set the current position as the markvoid
setMark(int newMark)
Set the mark to the given locationboolean
startsWith(java.lang.String prefix)
boolean
startsWith(java.lang.String prefix, boolean ignoreCase)
boolean
startsWith(java.lang.String prefix, int diff)
boolean
startsWith(java.lang.String prefix, int diff, boolean ignoreCase)
-
-
-
Method Detail
-
getMark
public int getMark()
- Returns:
- the marked position
-
setMark
public void setMark()
Set the current position as the mark
-
setMark
public void setMark(int newMark)
Set the mark to the given location- Parameters:
newMark
-
-
isMarked
public boolean isMarked()
- Returns:
- true if there is a mark set
-
getMarked
public java.lang.String getMarked()
- Returns:
- the marked section
-
markedToBlock
public Block markedToBlock()
- Returns:
- the marked string as a block
-
markedToStyledBlock
public Block markedToStyledBlock(java.lang.String styleName)
Create a style block, unless the stylename is equale to "none"- Parameters:
styleName
-- Returns:
- the marked string as a styled block
-
moveNext
public void moveNext()
Increase the pointer
-
moveNext
public void moveNext(int offset)
Increase the point with the given offset- Parameters:
offset
-
-
moveNextAndMark
public void moveNextAndMark()
Increase the pointer and mark the position after it
-
moveToEnd
public void moveToEnd()
Move to the end of the string
-
finished
public boolean finished()
- Returns:
- true if the iterator finished
-
current
public java.lang.Character current()
- Returns:
- the current character
-
next
public java.lang.Character next()
- Specified by:
next
in interfacejava.util.Iterator<java.lang.Character>
- Returns:
- the next character
-
next
public java.lang.Character next(int offset)
- Parameters:
offset
-- Returns:
- the characters at the given offset
-
prev
public java.lang.Character prev()
- Returns:
- the previous character
-
prev
public java.lang.Character prev(int offset)
- Parameters:
offset
-- Returns:
- the previous character at a given offset
-
startsWith
public boolean startsWith(java.lang.String prefix)
- Parameters:
prefix
-- Returns:
- true if the current position starts with the prefix
-
startsWith
public boolean startsWith(java.lang.String prefix, boolean ignoreCase)
- Parameters:
prefix
-ignoreCase
-- Returns:
- true if the current position starts with the prefix
-
startsWith
public boolean startsWith(java.lang.String prefix, int diff)
- Parameters:
prefix
-diff
-- Returns:
- true if the current position starts with the prefix at a given offset
-
startsWith
public boolean startsWith(java.lang.String prefix, int diff, boolean ignoreCase)
- Parameters:
prefix
-diff
-ignoreCase
-- Returns:
- true if the current position starts with the prefix at a given offset
-
createMatcher
public java.util.regex.Matcher createMatcher(java.util.regex.Pattern pattern)
Create a pattern matcher- Parameters:
pattern
-
-
getPosition
public int getPosition()
- Returns:
-
getLength
public int getLength()
- Returns:
-
remaining
public int remaining()
- Returns:
- the remaining characters in the buffer
-
indexOf
public int indexOf(java.lang.String substr)
- Parameters:
substr
-- Returns:
- the index of the given string
-
iterator
public java.util.Iterator<java.lang.Character> iterator()
- Specified by:
iterator
in interfacejava.lang.Iterable<java.lang.Character>
-
hasNext
public boolean hasNext()
- Specified by:
hasNext
in interfacejava.util.Iterator<java.lang.Character>
-
remove
public void remove()
- Specified by:
remove
in interfacejava.util.Iterator<java.lang.Character>
-
-