org.terrier.structures.indexing.singlepass
Class RunIterator

java.lang.Object
  extended by org.terrier.structures.indexing.singlepass.RunIterator
All Implemented Interfaces:
java.io.Closeable, java.util.Iterator<PostingInRun>
Direct Known Subclasses:
FileRunIterator, HadoopRunPostingIterator

public abstract class RunIterator
extends java.lang.Object
implements java.util.Iterator<PostingInRun>, java.io.Closeable

An abstract base class which allows PostingInRuns to be iterated over. Implementations are typically more generic versions of RunReader from Terrier 2.0 and 2.1.

Since:
2.2
Author:
Craig Macdonald

Field Summary
protected  int flushNo
          Run/Flush that the current posting came from
protected  int numberOfFields
           
protected  PostingInRun posting
          current posting
protected  java.lang.Class<? extends PostingInRun> postingClass
          class that new postings are derived from
 
Constructor Summary
protected RunIterator(java.lang.Class<? extends PostingInRun> _postingClass, int _runNo, int _numberOfFields)
          create a new instance of this class.
 
Method Summary
 void close()
          close this RunIterator
protected  void createPosting()
          Create a new posting
 PostingInRun current()
          returns the current posting
 int getRunNo()
          Get the run/flush number that the current posting came from
abstract  boolean hasNext()
          iterator implementation
abstract  PostingInRun next()
          iterator implementation
 void remove()
          unsupported iterator method
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

postingClass

protected java.lang.Class<? extends PostingInRun> postingClass
class that new postings are derived from


posting

protected PostingInRun posting
current posting


flushNo

protected int flushNo
Run/Flush that the current posting came from


numberOfFields

protected int numberOfFields
Constructor Detail

RunIterator

protected RunIterator(java.lang.Class<? extends PostingInRun> _postingClass,
                      int _runNo,
                      int _numberOfFields)
create a new instance of this class.

Parameters:
_postingClass - Class of the PostingInRun type that postings in this run have
_runNo - The run number currently being processed
Method Detail

createPosting

protected void createPosting()
                      throws java.lang.Exception
Create a new posting

Throws:
java.lang.Exception

getRunNo

public int getRunNo()
Get the run/flush number that the current posting came from


hasNext

public abstract boolean hasNext()
iterator implementation

Specified by:
hasNext in interface java.util.Iterator<PostingInRun>

next

public abstract PostingInRun next()
iterator implementation

Specified by:
next in interface java.util.Iterator<PostingInRun>

current

public PostingInRun current()
returns the current posting


remove

public void remove()
unsupported iterator method

Specified by:
remove in interface java.util.Iterator<PostingInRun>

close

public void close()
close this RunIterator

Specified by:
close in interface java.io.Closeable


Terrier 3.5. Copyright © 2004-2011 University of Glasgow