Class BasicIterablePosting
- java.lang.Object
-
- org.terrier.structures.postings.BasicPostingImpl
-
- org.terrier.structures.postings.bit.BasicIterablePosting
-
- All Implemented Interfaces:
java.io.Closeable,java.io.Serializable,java.lang.AutoCloseable,org.apache.hadoop.io.Writable,IterablePosting,Posting,WritablePosting
- Direct Known Subclasses:
BasicIterablePostingDocidOnly,BlockFieldIterablePosting,BlockIterablePosting,FieldIterablePosting
public class BasicIterablePosting extends BasicPostingImpl implements IterablePosting
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected BitInbitFileReaderprotected DocumentIndexdoiprotected intnumEntries-
Fields inherited from class org.terrier.structures.postings.BasicPostingImpl
dl, id, tf
-
Fields inherited from interface org.terrier.structures.postings.IterablePosting
END_OF_LIST, EOL
-
-
Constructor Summary
Constructors Constructor Description BasicIterablePosting()Empty constructor used ONLY for reflectionBasicIterablePosting(BitIn _bitFileReader, int _numEntries, DocumentIndex _doi)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description WritablePostingasWritablePosting()Copy this posting to one free of an iterator.voidclose()booleanendOfPostings()Status method to see if this posting list iterator has been finished.intgetDocumentLength()Returns 0intnext()Move this iterator to the next posting.intnext(int target)Move this iterator to the posting with specified id, or next posting after that if a posting with the specified id does not exist.java.lang.StringtoString()Makes a human readable form of this posting-
Methods inherited from class org.terrier.structures.postings.BasicPostingImpl
getFrequency, getId, readFields, setDocumentLength, setId, setTf, write
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.terrier.structures.postings.Posting
getFrequency, getId
-
-
-
-
Field Detail
-
numEntries
protected int numEntries
-
bitFileReader
protected BitIn bitFileReader
-
doi
protected DocumentIndex doi
-
-
Constructor Detail
-
BasicIterablePosting
public BasicIterablePosting()
Empty constructor used ONLY for reflection
-
BasicIterablePosting
public BasicIterablePosting(BitIn _bitFileReader, int _numEntries, DocumentIndex _doi) throws java.io.IOException
Constructor- Parameters:
_bitFileReader- The bit file where we read the postings from_numEntries- Total number of postings to read before returning EOL_doi- The document index to get the doc length of the current docid- Throws:
java.io.IOException
-
-
Method Detail
-
endOfPostings
public boolean endOfPostings()
Description copied from interface:IterablePostingStatus method to see if this posting list iterator has been finished.- Specified by:
endOfPostingsin interfaceIterablePosting- Returns:
- true if
IterablePosting.next()orIterablePosting.next(int)would return EOL or have returned EOL.
-
getDocumentLength
public int getDocumentLength()
Description copied from class:BasicPostingImplReturns 0- Specified by:
getDocumentLengthin interfacePosting- Overrides:
getDocumentLengthin classBasicPostingImpl- Returns:
- length of the document of the current posting in tokens.
-
close
public void close() throws java.io.IOException- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Throws:
java.io.IOException
-
asWritablePosting
public WritablePosting asWritablePosting()
Description copied from class:BasicPostingImplCopy this posting to one free of an iterator. Kind of like a clone.- Specified by:
asWritablePostingin interfacePosting- Overrides:
asWritablePostingin classBasicPostingImpl- Returns:
- an identical posting, but which can be manipulated free of this iterator
-
toString
public java.lang.String toString()
Description copied from class:BasicPostingImplMakes a human readable form of this posting- Overrides:
toStringin classBasicPostingImpl
-
next
public int next() throws java.io.IOExceptionDescription copied from interface:IterablePostingMove this iterator to the next posting.- Specified by:
nextin interfaceIterablePosting- Returns:
- id of next posting, or EOL if end of posting list.
- Throws:
java.io.IOException
-
next
public int next(int target) throws java.io.IOExceptionDescription copied from interface:IterablePostingMove this iterator to the posting with specified id, or next posting after that if a posting with the specified id does not exist. This is usually implemented internally byIterablePosting.next(), but more efficient implementations can override this behaviour.- Specified by:
nextin interfaceIterablePosting- Parameters:
target- id of the posting to find in this posting list.- Returns:
- id of the posting found, or EOL if end of posting list is reached.
- Throws:
java.io.IOException
-
-