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.MatchercreateMatcher(java.util.regex.Pattern pattern)Create a pattern matcherjava.lang.Charactercurrent()booleanfinished()intgetLength()intgetMark()java.lang.StringgetMarked()intgetPosition()booleanhasNext()intindexOf(java.lang.String substr)booleanisMarked()java.util.Iterator<java.lang.Character>iterator()BlockmarkedToBlock()BlockmarkedToStyledBlock(java.lang.String styleName)Create a style block, unless the stylename is equale to "none"voidmoveNext()Increase the pointervoidmoveNext(int offset)Increase the point with the given offsetvoidmoveNextAndMark()Increase the pointer and mark the position after itvoidmoveToEnd()Move to the end of the stringjava.lang.Characternext()java.lang.Characternext(int offset)java.lang.Characterprev()java.lang.Characterprev(int offset)intremaining()voidremove()voidsetMark()Set the current position as the markvoidsetMark(int newMark)Set the mark to the given locationbooleanstartsWith(java.lang.String prefix)booleanstartsWith(java.lang.String prefix, boolean ignoreCase)booleanstartsWith(java.lang.String prefix, int diff)booleanstartsWith(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:
nextin 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:
iteratorin interfacejava.lang.Iterable<java.lang.Character>
-
hasNext
public boolean hasNext()
- Specified by:
hasNextin interfacejava.util.Iterator<java.lang.Character>
-
remove
public void remove()
- Specified by:
removein interfacejava.util.Iterator<java.lang.Character>
-
-