Package net.sf.xslthl

Class CharIter

java.lang.Object
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 Details

    • CharIter

      public CharIter(String input)
  • Method Details

    • 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 "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 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>