org.terrier.structures.postings
Class ArrayOfBasicIterablePosting

java.lang.Object
  extended by org.terrier.structures.postings.IterablePostingImpl
      extended by org.terrier.structures.postings.ArrayOfIdsIterablePosting
          extended by org.terrier.structures.postings.ArrayOfBasicIterablePosting
All Implemented Interfaces:
Closeable, IterablePosting, Posting
Direct Known Subclasses:
ArrayOfFieldIterablePosting

public class ArrayOfBasicIterablePosting
extends ArrayOfIdsIterablePosting

An instance of IterablePostings that works with passed arrays of ids and frequencies

Author:
Craig Macdonald

Field Summary
protected  int[] doclens
           
protected  int[] frequencies
          frequencies of all of the stored postings
 
Fields inherited from class org.terrier.structures.postings.ArrayOfIdsIterablePosting
ids, indice
 
Fields inherited from interface org.terrier.structures.postings.IterablePosting
EOL
 
Constructor Summary
ArrayOfBasicIterablePosting(int[] _ids, int[] _freqs)
          Make a new posting list with these ids and frequencies
ArrayOfBasicIterablePosting(int[] _ids, int[] _freqs, int[] _lens)
           
 
Method Summary
 int getDocumentLength()
          Return the length of the document for this posting.
 int getFrequency()
          Return the frequency of the term in the current document
 
Methods inherited from class org.terrier.structures.postings.ArrayOfIdsIterablePosting
asWritablePosting, close, endOfPostings, getId, next, setId
 
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

frequencies

protected int[] frequencies
frequencies of all of the stored postings


doclens

protected int[] doclens
Constructor Detail

ArrayOfBasicIterablePosting

public ArrayOfBasicIterablePosting(int[] _ids,
                                   int[] _freqs)
Make a new posting list with these ids and frequencies


ArrayOfBasicIterablePosting

public ArrayOfBasicIterablePosting(int[] _ids,
                                   int[] _freqs,
                                   int[] _lens)
Method Detail

getFrequency

public int getFrequency()
Return the frequency of the term in the current document

Specified by:
getFrequency in interface Posting
Overrides:
getFrequency in class ArrayOfIdsIterablePosting
Returns:
frequency of posting, in tokens

getDocumentLength

public int getDocumentLength()
Description copied from class: ArrayOfIdsIterablePosting
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 0.

Specified by:
getDocumentLength in interface Posting
Overrides:
getDocumentLength in class ArrayOfIdsIterablePosting
Returns:
length of the document of the current posting in tokens.


Terrier 3.6. Copyright © 2004-2011 University of Glasgow