Terrier IR Platform
2.2.1

uk.ac.gla.terrier.structures.indexing.singlepass
Class FileRunIterator<K extends PostingInRun>

java.lang.Object
  extended by uk.ac.gla.terrier.structures.indexing.singlepass.RunIterator
      extended by uk.ac.gla.terrier.structures.indexing.singlepass.FileRunIterator<K>
All Implemented Interfaces:
java.util.Iterator<PostingInRun>, Closeable

public class FileRunIterator<K extends PostingInRun>
extends RunIterator

Reads runs of flushed term posting lists by reading them from files.

Since:
2.2
Version:
$Revision: 1.4 $
Author:
Craig Macdonald

Constructor Summary
FileRunIterator(java.lang.String filename, java.lang.String termsFile, int runNo, java.lang.Class<? extends PostingInRun> _postingInRunClass)
          Load a new run from files.
 
Method Summary
 void close()
          Closes the run files being processed
 boolean hasNext()
          Are there more posting to process in this run?
 PostingInRun next()
          Move to the next posting in this run
 java.lang.String readString()
          Reads the String identifying a term from the underlying stream.
 int readTermFrequency()
          Reads the term frequency for the current posting, and aligns the stream.
 
Methods inherited from class uk.ac.gla.terrier.structures.indexing.singlepass.RunIterator
current, getRunNo, remove
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileRunIterator

public FileRunIterator(java.lang.String filename,
                       java.lang.String termsFile,
                       int runNo,
                       java.lang.Class<? extends PostingInRun> _postingInRunClass)
                throws java.lang.Exception
Load a new run from files.

Parameters:
filename - the filename of the file containing the posting lists
termsFile - the filename of the file containing the term names
runNo - the number of this run
_postingInRunClass - the class that all postings in this class have
Throws:
java.lang.Exception
Method Detail

close

public void close()
Closes the run files being processed

Specified by:
close in interface Closeable
Overrides:
close in class RunIterator

hasNext

public boolean hasNext()
Are there more posting to process in this run?

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

next

public PostingInRun next()
Move to the next posting in this run

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

readTermFrequency

public int readTermFrequency()
                      throws java.io.IOException
Reads the term frequency for the current posting, and aligns the stream.

Returns:
the frequency read.
Throws:
java.io.IOException - if an I/O error occurs.

readString

public java.lang.String readString()
                            throws java.io.IOException
Reads the String identifying a term from the underlying stream.

Returns:
the String with the term.
Throws:
java.io.IOException - if an I/O error occurs.

Terrier IR Platform
2.2.1

Terrier Information Retrieval Platform 2.2.1. Copyright 2004-2008 University of Glasgow