net.sf.xslthl
Class CharIter

java.lang.Object
  extended by net.sf.xslthl.CharIter
All Implemented Interfaces:
Iterable<Character>, Iterator<Character>

public class CharIter
extends Object
implements Iterable<Character>, Iterator<Character>

A special character iterator


Constructor Summary
CharIter(String input)
           
 
Method Summary
 Matcher createMatcher(Pattern pattern)
          Create a pattern matcher
 Character current()
           
 boolean finished()
           
 int getLength()
           
 int getMark()
           
 String getMarked()
           
 int getPosition()
           
 boolean hasNext()
           
 int indexOf(String substr)
           
 boolean isMarked()
           
 Iterator<Character> iterator()
           
 Block markedToBlock()
           
 Block markedToStyledBlock(String styleName)
          Create a style block, unless the stylename is equale to
 void moveNext()
          Increase the pointer
 void moveNext(int offset)
          Increase the point with the given offset
 void moveNextAndMark()
          Increase the pointer and mark the position after it
 void moveToEnd()
          Move to the end of the string
 Character next()
           
 Character next(int offset)
           
 Character prev()
           
 Character prev(int offset)
           
 int remaining()
           
 void remove()
           
 void setMark()
          Set the current position as the mark
 void setMark(int newMark)
          Set the mark to the given location
 boolean startsWith(String prefix)
           
 boolean startsWith(String prefix, boolean ignoreCase)
           
 boolean startsWith(String prefix, int diff)
           
 boolean startsWith(String prefix, int diff, boolean ignoreCase)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CharIter

public CharIter(String input)
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 String getMarked()
Returns:
the marked section

markedToBlock

public Block markedToBlock()
Returns:
the marked string as a block

markedToStyledBlock

public Block markedToStyledBlock(String styleName)
Create a style block, unless the stylename is equale to

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 Character current()
Returns:
the current character

next

public Character next()
Specified by:
next in interface Iterator<Character>
Returns:
the next character

next

public Character next(int offset)
Parameters:
offset -
Returns:
the characters at the given offset

prev

public Character prev()
Returns:
the previous character

prev

public Character prev(int offset)
Parameters:
offset -
Returns:
the previous character at a given offset

startsWith

public boolean startsWith(String prefix)
Parameters:
prefix -
Returns:
true if the current position starts with the prefix

startsWith

public boolean startsWith(String prefix,
                          boolean ignoreCase)
Parameters:
prefix -
ignoreCase -
Returns:
true if the current position starts with the prefix

startsWith

public boolean startsWith(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(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 Matcher createMatcher(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(String substr)
Parameters:
substr -
Returns:
the index of the given string

iterator

public Iterator<Character> iterator()
Specified by:
iterator in interface Iterable<Character>

hasNext

public boolean hasNext()
Specified by:
hasNext in interface Iterator<Character>

remove

public void remove()
Specified by:
remove in interface Iterator<Character>


Copyright © 2005-2014. All Rights Reserved.