Package org.terrier.structures.bit
Class BitPostingIndexInputStream
- java.lang.Object
-
- org.terrier.structures.bit.BitPostingIndexInputStream
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable,java.util.Iterator<IterablePosting>,PostingIndexInputStream,Skipable
public class BitPostingIndexInputStream extends java.lang.Object implements PostingIndexInputStream, Skipable
Input stream for a bit posting index.
-
-
Field Summary
Fields Modifier and Type Field Description protected intcurrentEntryCountprotected bytecurrentFileprotected BitIndexPointercurrentPointerprotected DocumentIndexdoiprotected intentriesSkippedprotected intfieldCountprotected BitInfileThe gamma compressed file containing the terms.protected bytefileCountprotected IndexOnDiskindexprotected static org.slf4j.Loggerloggerprotected java.util.Iterator<? extends BitIndexPointer>pointerListthe lexicon input stream providing the offsetsprotected java.lang.reflect.Constructor<? extends IterablePosting>postingConstructorprotected java.lang.Class<? extends IterablePosting>postingIteratorClassprotected java.lang.StringstructureName
-
Constructor Summary
Constructors Constructor Description BitPostingIndexInputStream(IndexOnDisk _index, java.lang.String _structureName, java.util.Iterator<? extends BitIndexPointer> _pointerList, java.lang.Class<? extends IterablePosting> _postingIteratorClass)Constructs an instance of BitPostingIndexInputStream.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected BitIndexPointer_next()voidclose()PointergetCurrentPointer()Returns the pointer associated with the current postings being accessedprotected DocumentIndexgetDocumentIndex(BitIndexPointer pointer)intgetEntriesSkipped()Returns the number of entries that were skipped during a call to the next().static java.lang.StringgetFilename(java.lang.String path, java.lang.String prefix, java.lang.String structureName, byte fileCount, byte fileId)Return filenamestatic java.lang.StringgetFilename(IndexOnDisk _index, java.lang.String structureName, byte fileCount, byte fileId)Returns filenameIterablePostinggetNextPostings()Return the next IterablePosting object, or null if none defined.intgetNumberOfCurrentPostings()Returns the number of postings in the current IterablePosting objectBitFilePositiongetPos()Get the file positionbooleanhasNext()protected IterablePostingloadPostingIterator(BitIndexPointer pointer)IterablePostingnext()voidprint()Print a list of the postings to standard outvoidremove()Not supportedvoidskip(int numEntries)
-
-
-
Field Detail
-
logger
protected static final org.slf4j.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 IndexOnDisk index
-
doi
protected DocumentIndex doi
-
structureName
protected java.lang.String structureName
-
-
Constructor Detail
-
BitPostingIndexInputStream
public BitPostingIndexInputStream(IndexOnDisk _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(IndexOnDisk _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
-
getNumberOfCurrentPostings
public int getNumberOfCurrentPostings()
Returns the number of postings in the current IterablePosting object- Specified by:
getNumberOfCurrentPostingsin interfacePostingIndexInputStream
-
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:
getNextPostingsin interfacePostingIndexInputStream- Returns:
- IterablePosting postings for next object
- Throws:
java.io.IOException- if an I/O problem occurs.
-
hasNext
public boolean hasNext()
- Specified by:
hasNextin interfacejava.util.Iterator<IterablePosting>
-
_next
protected BitIndexPointer _next()
-
next
public IterablePosting next()
- Specified by:
nextin interfacejava.util.Iterator<IterablePosting>
-
getEntriesSkipped
public int getEntriesSkipped()
Returns the number of entries that were skipped during a call to the next().- Specified by:
getEntriesSkippedin interfacePostingIndexInputStream- 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- Specified by:
printin interfacePostingIndexInputStream
-
close
public void close() throws java.io.IOException- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Throws:
java.io.IOException
-
remove
public void remove()
Not supported- Specified by:
removein interfacejava.util.Iterator<IterablePosting>
-
getCurrentPointer
public Pointer getCurrentPointer()
Returns the pointer associated with the current postings being accessed- Specified by:
getCurrentPointerin interfacePostingIndexInputStream
-
-