Textractor API textractor-720 (20091120123250)

textractor.tools
Class QueryResultIntervalIterator

java.lang.Object
  extended by textractor.tools.QueryResultIntervalIterator
All Implemented Interfaces:
IntervalIterator, Iterator<Interval>

public final class QueryResultIntervalIterator
extends Object
implements IntervalIterator


Constructor Summary
QueryResultIntervalIterator(DocumentQueryResult queryResult, int document)
           
 
Method Summary
 int extent()
           
 boolean hasNext()
           
 Interval next()
          Deprecated. 
 Interval nextInterval()
          Returns the next interval provided by this interval iterator, or null if no more intervals are available.
 void remove()
           
 void reset()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QueryResultIntervalIterator

public QueryResultIntervalIterator(DocumentQueryResult queryResult,
                                   int document)
Method Detail

reset

public void reset()
Specified by:
reset in interface IntervalIterator

extent

public int extent()
Specified by:
extent in interface IntervalIterator

nextInterval

public Interval nextInterval()
                      throws IOException
Returns the next interval provided by this interval iterator, or null if no more intervals are available.

This method has been reintroduced in MG4J 1.2 with a different semantics. The special return value null is used to mark the end of iteration. The reason for this change is providing fully lazy iteration over intervals. Fully lazy iteration does not provide an hasNext() method—you have to actually ask for the next element and check the return value. Fully lazy iteration is much lighter on method calls (half) and in most (if not all) MG4J classes leads to a much simpler logic. Moreover, nextInterval() can be specified as throwing an IOException, which avoids the pernicious proliferation of try/catch blocks in very short, low-level methods (it was having a detectable impact on performance).

Specified by:
nextInterval in interface IntervalIterator
Returns:
the next interval, or null if no more intervals are available.
Throws:
IOException

hasNext

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

next

@Deprecated
public Interval next()
Deprecated. 

Specified by:
next in interface IntervalIterator
Specified by:
next in interface Iterator<Interval>

remove

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

Textractor API textractor-720 (20091120123250)

Copyright © 2003-2008 Institute for Computational Biomedicine, All Rights Reserved.