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 BitIn
bitFileReader
protected DocumentIndex
doi
protected int
numEntries
-
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 WritablePosting
asWritablePosting()
Copy this posting to one free of an iterator.void
close()
boolean
endOfPostings()
Status method to see if this posting list iterator has been finished.int
getDocumentLength()
Returns 0int
next()
Move this iterator to the next posting.int
next(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.String
toString()
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:IterablePosting
Status method to see if this posting list iterator has been finished.- Specified by:
endOfPostings
in interfaceIterablePosting
- Returns:
- true if
IterablePosting.next()
orIterablePosting.next(int)
would return EOL or have returned EOL.
-
getDocumentLength
public int getDocumentLength()
Description copied from class:BasicPostingImpl
Returns 0- Specified by:
getDocumentLength
in interfacePosting
- Overrides:
getDocumentLength
in classBasicPostingImpl
- Returns:
- length of the document of the current posting in tokens.
-
close
public void close() throws java.io.IOException
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Throws:
java.io.IOException
-
asWritablePosting
public WritablePosting asWritablePosting()
Description copied from class:BasicPostingImpl
Copy this posting to one free of an iterator. Kind of like a clone.- Specified by:
asWritablePosting
in interfacePosting
- Overrides:
asWritablePosting
in classBasicPostingImpl
- Returns:
- an identical posting, but which can be manipulated free of this iterator
-
toString
public java.lang.String toString()
Description copied from class:BasicPostingImpl
Makes a human readable form of this posting- Overrides:
toString
in classBasicPostingImpl
-
next
public int next() throws java.io.IOException
Description copied from interface:IterablePosting
Move this iterator to the next posting.- Specified by:
next
in 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.IOException
Description copied from interface:IterablePosting
Move 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:
next
in 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
-
-