com.sun.labs.minion.retrieval.cache
Class TermCacheElement.TCEIterator

java.lang.Object
  extended by com.sun.labs.minion.retrieval.cache.TermCacheElement.TCEIterator
All Implemented Interfaces:
PostingsIterator
Enclosing class:
TermCacheElement

public class TermCacheElement.TCEIterator
extends java.lang.Object
implements PostingsIterator

An iterator for this element of the term cache.


Constructor Summary
TermCacheElement.TCEIterator(WeightingComponents wc, WeightingFunction wf)
           
 
Method Summary
 int compareTo(java.lang.Object o)
          Compares this postings iterator to another one.
 boolean findID(int id)
          Finds the given document in the entry we're iterating through, if it exists.
 int get(int[] ids)
          Reads a number of IDs into the provided array.
 int get(int[] ids, float[] weights)
          Reads a number of IDs and the associated weights into the provided arrays.
 int get(int[] ids, int[] freq)
          Reads a number of IDs and frequencies into the provided arrays.
 PostingsIteratorFeatures getFeatures()
          Gets the features that were used to create this iterator.
 int getFreq()
          Gets the frequency of the term in the current document.
 int getID()
          Gets the document sequence number that the iterator is currently pointing at.
 int getN()
          Gets the number of IDs that this iterator will produce.
 float getWeight()
          Gets the weight of the term in the current document, as generated by some weighting function.
 boolean next()
          Moves to the next document in this entry.
 void reset()
          Resets the iterator to the beginning of the entry.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TermCacheElement.TCEIterator

public TermCacheElement.TCEIterator(WeightingComponents wc,
                                    WeightingFunction wf)
Method Detail

getFeatures

public PostingsIteratorFeatures getFeatures()
Description copied from interface: PostingsIterator
Gets the features that were used to create this iterator.

Specified by:
getFeatures in interface PostingsIterator
Returns:
the features used to create the iterator, or null if no features were used.

getN

public int getN()
Description copied from interface: PostingsIterator
Gets the number of IDs that this iterator will produce.

Specified by:
getN in interface PostingsIterator

get

public int get(int[] ids)
Description copied from interface: PostingsIterator
Reads a number of IDs into the provided array.

Specified by:
get in interface PostingsIterator

get

public int get(int[] ids,
               int[] freq)
Description copied from interface: PostingsIterator
Reads a number of IDs and frequencies into the provided arrays.

Specified by:
get in interface PostingsIterator
Parameters:
ids - an array into which IDs will be placed. If possible, the array will be filled.
freq - an array into which frequencies will be placed. If possible, the array will be filled.
Returns:
the number of ids and frequencies read into the array, which may be smaller than the size of the array.

get

public int get(int[] ids,
               float[] weights)
Description copied from interface: PostingsIterator
Reads a number of IDs and the associated weights into the provided arrays.

Specified by:
get in interface PostingsIterator
Parameters:
ids - an array into which IDs will be placed. If possible, the array will be filled.
weights - an array into which weights will be placed. If possible, the array will be filled.
Returns:
the number of ids and frequencies read into the array, which may be smaller than the size of the array.

next

public boolean next()
Description copied from interface: PostingsIterator
Moves to the next document in this entry. This method is different than the java.util.Iterator.next() method in that it does not return an object. This would require too much object creation overhead during retrieval, and saves the whole hasNext()/next() function call overhead. You should use the accessor functions for the iterator to find out the actual document, position, etc. that the iterator is at.

Specified by:
next in interface PostingsIterator
Returns:
true if there is a next value, false otherwise.

findID

public boolean findID(int id)
Description copied from interface: PostingsIterator
Finds the given document in the entry we're iterating through, if it exists. If the document occurs in this entry, the iterator is left in a state where the data for that document has been decoded. If the document does not occur in this entry, the iterator is left in a state where the data for the next-highest document sequence number in this entry has been decoded.

Specified by:
findID in interface PostingsIterator
Parameters:
id - The ID that we want to find.
Returns:
true if the ID occurs in this entry, false otherwise.
See Also:
PostingsIterator.reset()

reset

public void reset()
Description copied from interface: PostingsIterator
Resets the iterator to the beginning of the entry. Data will not be decoded until the next method is called.

Specified by:
reset in interface PostingsIterator

getID

public int getID()
Description copied from interface: PostingsIterator
Gets the document sequence number that the iterator is currently pointing at.

Specified by:
getID in interface PostingsIterator
Returns:
The document sequence number that the iterator is pointing at, or 0 if the iterator has not been advanced yet, or has been exhausted.

getWeight

public float getWeight()
Description copied from interface: PostingsIterator
Gets the weight of the term in the current document, as generated by some weighting function.

Specified by:
getWeight in interface PostingsIterator

getFreq

public int getFreq()
Description copied from interface: PostingsIterator
Gets the frequency of the term in the current document.

Specified by:
getFreq in interface PostingsIterator

compareTo

public int compareTo(java.lang.Object o)
Description copied from interface: PostingsIterator
Compares this postings iterator to another one. Typically this comparison should be based on the ID at the head of the iterator.

Specified by:
compareTo in interface PostingsIterator