org.terrier.structures
Class BitPostingIndexInputStream

java.lang.Object
  extended by org.terrier.structures.BitPostingIndexInputStream
All Implemented Interfaces:
java.io.Closeable, java.util.Iterator<IterablePosting>, PostingIndexInputStream, Skipable
Direct Known Subclasses:
DirectIndexInputStream, InvertedIndexInputStream

public class BitPostingIndexInputStream
extends java.lang.Object
implements PostingIndexInputStream, Skipable

Input stream for a bit posting index.


Field Summary
protected  int currentEntryCount
           
protected  byte currentFile
           
protected  BitIndexPointer currentPointer
           
protected  DocumentIndex doi
           
protected  int entriesSkipped
           
protected  int fieldCount
           
protected  BitIn file
          The gamma compressed file containing the terms.
protected  byte fileCount
           
protected  Index index
           
protected static org.apache.log4j.Logger logger
           
protected  java.util.Iterator<? extends BitIndexPointer> pointerList
          the lexicon input stream providing the offsets
protected  java.lang.reflect.Constructor<? extends IterablePosting> postingConstructor
           
protected  java.lang.Class<? extends IterablePosting> postingIteratorClass
           
protected  java.lang.String structureName
           
 
Constructor Summary
BitPostingIndexInputStream(Index _index, java.lang.String _structureName, java.util.Iterator<? extends BitIndexPointer> _pointerList, java.lang.Class<? extends IterablePosting> _postingIteratorClass)
          Constructs an instance of BitPostingIndexInputStream.
 
Method Summary
protected  BitIndexPointer _next()
           
 void close()
          
 Pointer getCurrentPointer()
          Returns the pointer associated with the current postings being accessed
protected  DocumentIndex getDocumentIndex(BitIndexPointer pointer)
           
 int getEntriesSkipped()
          Returns the number of entries that were skipped during a call to the next().
static java.lang.String getFilename(Index _index, java.lang.String structureName, byte fileCount, byte fileId)
          Returns filename
static java.lang.String getFilename(java.lang.String path, java.lang.String prefix, java.lang.String structureName, byte fileCount, byte fileId)
          Return filename
 IterablePosting getNextPostings()
          Return the next IterablePosting object, or null if none defined.
 int getNumberOfCurrentPostings()
          Returns the number of postings in the current IterablePosting object
 BitFilePosition getPos()
          Get the file position
 boolean hasNext()
          
protected  IterablePosting loadPostingIterator(BitIndexPointer pointer)
           
 IterablePosting next()
          
 void print()
          Print a list of the postings to standard out
 void remove()
          Not supported
 void skip(int numEntries)
          Skip forward the specified number of entries.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected static final org.apache.log4j.Logger logger

pointerList

protected final java.util.Iterator<? extends BitIndexPointer> pointerList
the lexicon input stream providing the offsets


file

protected BitIn file
The gamma compressed file containing the terms.


postingIteratorClass

protected java.lang.Class<? extends IterablePosting> postingIteratorClass

postingConstructor

protected java.lang.reflect.Constructor<? extends IterablePosting> postingConstructor

currentEntryCount

protected int currentEntryCount

currentPointer

protected BitIndexPointer currentPointer

fieldCount

protected int fieldCount

entriesSkipped

protected int entriesSkipped

fileCount

protected byte fileCount

currentFile

protected byte currentFile

index

protected Index index

doi

protected DocumentIndex doi

structureName

protected java.lang.String structureName
Constructor Detail

BitPostingIndexInputStream

public BitPostingIndexInputStream(Index _index,
                                  java.lang.String _structureName,
                                  java.util.Iterator<? extends BitIndexPointer> _pointerList,
                                  java.lang.Class<? extends IterablePosting> _postingIteratorClass)
                           throws java.io.IOException
Constructs an instance of BitPostingIndexInputStream.

Parameters:
_index -
_structureName -
_pointerList -
_postingIteratorClass -
Throws:
java.io.IOException
Method Detail

getFilename

public static java.lang.String getFilename(java.lang.String path,
                                           java.lang.String prefix,
                                           java.lang.String structureName,
                                           byte fileCount,
                                           byte fileId)
Return filename

Parameters:
path -
prefix -
structureName -
fileCount -
fileId -
Returns:
filename

getFilename

public static java.lang.String getFilename(Index _index,
                                           java.lang.String structureName,
                                           byte fileCount,
                                           byte fileId)
Returns filename

Parameters:
_index -
structureName -
fileCount -
fileId -
Returns:
filename

getPos

public BitFilePosition getPos()
Get the file position


skip

public void skip(int numEntries)
          throws java.io.IOException
Skip forward the specified number of entries. Should be followed by a next() call.

Specified by:
skip in interface Skipable
Parameters:
numEntries - number of entries to skip
Throws:
java.io.IOException - if an IO problem occurs.

getNumberOfCurrentPostings

public int getNumberOfCurrentPostings()
Returns the number of postings in the current IterablePosting object

Specified by:
getNumberOfCurrentPostings in interface PostingIndexInputStream

getNextPostings

public IterablePosting getNextPostings()
                                throws java.io.IOException
Return the next IterablePosting object, or null if none defined. Use this method instead of hasNext() and next().

Specified by:
getNextPostings in interface PostingIndexInputStream
Returns:
IterablePosting postings for next object
Throws:
java.io.IOException - if an I/O problem occurs.

hasNext

public boolean hasNext()

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

_next

protected BitIndexPointer _next()

next

public IterablePosting next()

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

getEntriesSkipped

public int getEntriesSkipped()
Returns the number of entries that were skipped during a call to the next().

Specified by:
getEntriesSkipped in interface PostingIndexInputStream
Returns:
int the number of entries skipped.

loadPostingIterator

protected IterablePosting loadPostingIterator(BitIndexPointer pointer)
                                       throws java.io.IOException
Throws:
java.io.IOException

getDocumentIndex

protected DocumentIndex getDocumentIndex(BitIndexPointer pointer)

print

public void print()
Print a list of the postings to standard out


close

public void close()
           throws java.io.IOException

Specified by:
close in interface java.io.Closeable
Throws:
java.io.IOException

remove

public void remove()
Not supported

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

getCurrentPointer

public Pointer getCurrentPointer()
Returns the pointer associated with the current postings being accessed

Specified by:
getCurrentPointer in interface PostingIndexInputStream


Terrier 3.5. Copyright © 2004-2011 University of Glasgow