org.tinyjee.maven.dim.sources
Class AbstractStreamingSnippetSelector.AbstractStreamIterator<E>

java.lang.Object
  extended by org.tinyjee.maven.dim.sources.AbstractStreamingSnippetSelector.AbstractStreamIterator<E>
Type Parameters:
E - the type of the used expression.
All Implemented Interfaces:
Iterator<Integer>
Enclosing class:
AbstractStreamingSnippetSelector

protected abstract static class AbstractStreamingSnippetSelector.AbstractStreamIterator<E>
extends Object
implements Iterator<Integer>

Is the actual base for line number iterators that directly operate on the content stream.


Constructor Summary
protected AbstractStreamingSnippetSelector.AbstractStreamIterator(E expression, LineNumberReader content)
          Constructs a new instance with the given expression around the specified input stream.
 
Method Summary
protected  boolean doHasNext()
           
 boolean hasNext()
           
protected abstract  boolean isCapturingLine(boolean alreadyCapturing, E expression, String line, int lineNumber)
          Returns true if the current line should be captured.
 Integer next()
           
 void remove()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractStreamingSnippetSelector.AbstractStreamIterator

protected AbstractStreamingSnippetSelector.AbstractStreamIterator(E expression,
                                                                  LineNumberReader content)
Constructs a new instance with the given expression around the specified input stream.

Parameters:
expression - the expression to use for selecting snippets.
content - the input stream (as LineNumberReader).
Method Detail

isCapturingLine

protected abstract boolean isCapturingLine(boolean alreadyCapturing,
                                           E expression,
                                           String line,
                                           int lineNumber)
Returns true if the current line should be captured.

Parameters:
alreadyCapturing - true if the previous line was captured.
expression - the expression to match the line with.
line - the line to test.
lineNumber - the line number of the given line.
Returns:
true if the current line should be captured.

doHasNext

protected boolean doHasNext()
                     throws IOException
Throws:
IOException

hasNext

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

next

public Integer next()
Specified by:
next in interface Iterator<Integer>

remove

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

toString

public String toString()
Overrides:
toString in class Object