edu.stanford.nlp.objectbank
Class DelimitRegExIterator<T>

java.lang.Object
  extended by edu.stanford.nlp.util.AbstractIterator<T>
      extended by edu.stanford.nlp.objectbank.DelimitRegExIterator<T>
Type Parameters:
T - The type of the objects returned
All Implemented Interfaces:
Iterator<T>

public class DelimitRegExIterator<T>
extends AbstractIterator<T>

An Iterator that reads the contents of a Reader, delimited by the specified delimiter, and then be subsequently processed by an Function to produce Objects of type T.

Author:
Jenny Finkel
Nested Class Summary
static class DelimitRegExIterator.DelimitRegExIteratorFactory<T>
           
 
Constructor Summary
DelimitRegExIterator(Reader r, String delimiter, Function<String,T> op)
           
 
Method Summary
static DelimitRegExIterator<String> defaultDelimitRegExIterator(Reader in, String delimiter)
           
static IteratorFromReaderFactory<String> getFactory(String delim)
          Returns a factory that vends DelimitRegExIterators that read the contents of the given Reader, splits on the specified delimiter, then returns the result.
static
<T> IteratorFromReaderFactory<T>
getFactory(String delim, Function<String,T> op)
          Returns a factory that vends DelimitRegExIterators that reads the contents of the given Reader, splits on the specified delimiter, applies op, then returns the result.
 boolean hasNext()
           
static void main(String[] args)
           
 T next()
           
protected  T parseString(String s)
           
 Object peek()
           
 
Methods inherited from class edu.stanford.nlp.util.AbstractIterator
remove
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DelimitRegExIterator

public DelimitRegExIterator(Reader r,
                            String delimiter,
                            Function<String,T> op)
Method Detail

defaultDelimitRegExIterator

public static DelimitRegExIterator<String> defaultDelimitRegExIterator(Reader in,
                                                                       String delimiter)

parseString

protected T parseString(String s)

hasNext

public boolean hasNext()
Specified by:
hasNext in interface Iterator<T>
Specified by:
hasNext in class AbstractIterator<T>

next

public T next()
Specified by:
next in interface Iterator<T>
Specified by:
next in class AbstractIterator<T>

peek

public Object peek()

getFactory

public static IteratorFromReaderFactory<String> getFactory(String delim)
Returns a factory that vends DelimitRegExIterators that read the contents of the given Reader, splits on the specified delimiter, then returns the result.


getFactory

public static <T> IteratorFromReaderFactory<T> getFactory(String delim,
                                                          Function<String,T> op)
Returns a factory that vends DelimitRegExIterators that reads the contents of the given Reader, splits on the specified delimiter, applies op, then returns the result.


main

public static void main(String[] args)


Stanford NLP Group