org.terrier.structures.postings
Class ANDIterablePosting

java.lang.Object
  extended by org.terrier.structures.postings.IterablePostingImpl
      extended by org.terrier.structures.postings.ANDIterablePosting
All Implemented Interfaces:
Closeable, IterablePosting, Posting
Direct Known Subclasses:
PhraseIterablePosting, ProximityIterablePosting

public class ANDIterablePosting
extends IterablePostingImpl

An instance of IterablePostings that works with passed arrays of ids and frequencies. The document must contain all of the terms in the query to be matched (AND)

Author:
richardm

Field Summary
protected  int currentId
           
protected  int frequency
           
protected  IterablePosting[] ips
           
protected  int termCount
           
 
Fields inherited from interface org.terrier.structures.postings.IterablePosting
EOL
 
Constructor Summary
ANDIterablePosting(IterablePosting[] _ips, Pointer[] _p)
           
 
Method Summary
 WritablePosting asWritablePosting()
          Copies this posting to one free of an iterator.
protected  boolean calculateFrequency()
          returns true if the document matches
 void close()
           
 boolean endOfPostings()
          Status method to see if this posting list iterator has been finished
 int getDocumentLength()
          Return the length of the document for this posting.
 int getFrequency()
          Return the frequency of the term in the current document
 int getId()
          Return the id of the current posting.
 int next()
          Move this iterator to the next posting.
 void setId(int id)
          It may be of benefit to update the frequency of the id in some applications.
 
Methods inherited from class org.terrier.structures.postings.IterablePostingImpl
next
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

currentId

protected int currentId

ips

protected IterablePosting[] ips

termCount

protected final int termCount

frequency

protected int frequency
Constructor Detail

ANDIterablePosting

public ANDIterablePosting(IterablePosting[] _ips,
                          Pointer[] _p)
                   throws IOException
Throws:
IOException
Method Detail

getId

public int getId()
Description copied from interface: Posting
Return the id of the current posting. For the inverted index, this is the docid; for the direct index it corresponds to the term id

Returns:
id of the posting

getFrequency

public int getFrequency()
Description copied from interface: Posting
Return the frequency of the term in the current document

Returns:
frequency of posting, in tokens

getDocumentLength

public int getDocumentLength()
Description copied from interface: Posting
Return the length of the document for this posting. Usually uses the DocumentIndex, may do otherwise if document length statistics are in posting list

Returns:
length of the document of the current posting in tokens.

setId

public void setId(int id)
Description copied from interface: Posting
It may be of benefit to update the frequency of the id in some applications. This should not be used lightly, as it may break the decompression of other postings in iterators.


next

public int next()
         throws IOException
Description copied from interface: IterablePosting
Move this iterator to the next posting.

Returns:
id of next posting, or EOL if end of posting list
Throws:
IOException

calculateFrequency

protected boolean calculateFrequency()
returns true if the document matches


endOfPostings

public boolean endOfPostings()
Description copied from interface: IterablePosting
Status method to see if this posting list iterator has been finished

Returns:
true if next() or next(int) would return EOL or have returned EOL.

close

public void close()
           throws IOException
Throws:
IOException

asWritablePosting

public WritablePosting asWritablePosting()
Description copied from interface: Posting
Copies this posting to one free of an iterator. Kind of like a clone.

Returns:
an identical posting, but which can be maniulated free of this iterator


Terrier 3.6. Copyright © 2004-2011 University of Glasgow