edu.washington.cs.knowitall.io
Class SmartTextBlockIterator

java.lang.Object
  extended by com.google.common.collect.UnmodifiableIterator<T>
      extended by com.google.common.collect.AbstractIterator<java.lang.String>
          extended by edu.washington.cs.knowitall.io.SmartTextBlockIterator
All Implemented Interfaces:
java.util.Iterator<java.lang.String>

public class SmartTextBlockIterator
extends com.google.common.collect.AbstractIterator<java.lang.String>

Buffers text "blocks" from a source of strings and iterates over the blocks. By default, a newline is used to separate blocks, but a custom value can be set.

Author:
afader

Constructor Summary
SmartTextBlockIterator(java.io.BufferedReader reader)
          Constructs a TextBlockIterator using a newline as the default break.
SmartTextBlockIterator(java.io.BufferedReader reader, java.lang.String blockBreak)
           
SmartTextBlockIterator(java.lang.Iterable<java.lang.String> iter)
          Constructs a TextBlockIterator over the strings returned by iter, using the default block break.
SmartTextBlockIterator(java.lang.Iterable<java.lang.String> iter, java.lang.String blockBreak)
          Constructs a TextBlockIterator over the strings returned by iter.
SmartTextBlockIterator(java.util.Iterator<java.lang.String> lineIter)
          Constructs a TextBlockIterator over the strings returned by lineIter, using the default block break.
SmartTextBlockIterator(java.util.Iterator<java.lang.String> lineIter, java.lang.String blockBreak)
          Constructs a TextBlockIterator over the strings returned by lineIter.
 
Method Summary
protected  java.lang.String computeNext()
           
 
Methods inherited from class com.google.common.collect.AbstractIterator
endOfData, hasNext, next, peek
 
Methods inherited from class com.google.common.collect.UnmodifiableIterator
remove
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SmartTextBlockIterator

public SmartTextBlockIterator(java.io.BufferedReader reader,
                              java.lang.String blockBreak)
Parameters:
reader - the reader to extract blocks from.
blockBreak - the value that represents a block break.

SmartTextBlockIterator

public SmartTextBlockIterator(java.io.BufferedReader reader)
Constructs a TextBlockIterator using a newline as the default break.

Parameters:
reader - the reader to extract blocks from.

SmartTextBlockIterator

public SmartTextBlockIterator(java.util.Iterator<java.lang.String> lineIter,
                              java.lang.String blockBreak)
Constructs a TextBlockIterator over the strings returned by lineIter.

Parameters:
lineIter -
blockBreak -

SmartTextBlockIterator

public SmartTextBlockIterator(java.util.Iterator<java.lang.String> lineIter)
Constructs a TextBlockIterator over the strings returned by lineIter, using the default block break.

Parameters:
lineIter -

SmartTextBlockIterator

public SmartTextBlockIterator(java.lang.Iterable<java.lang.String> iter,
                              java.lang.String blockBreak)
Constructs a TextBlockIterator over the strings returned by iter.

Parameters:
iter -
blockBreak -

SmartTextBlockIterator

public SmartTextBlockIterator(java.lang.Iterable<java.lang.String> iter)
Constructs a TextBlockIterator over the strings returned by iter, using the default block break.

Parameters:
iter -
Method Detail

computeNext

protected java.lang.String computeNext()
Specified by:
computeNext in class com.google.common.collect.AbstractIterator<java.lang.String>