org.galagosearch.core.retrieval.structured
Class CountIterator

java.lang.Object
  extended by org.galagosearch.core.retrieval.structured.CountIterator
All Implemented Interfaces:
java.lang.Comparable<CountIterator>, StructuredIterator
Direct Known Subclasses:
ExtentIterator

public abstract class CountIterator
extends java.lang.Object
implements StructuredIterator, java.lang.Comparable<CountIterator>

This is base interface for all inverted lists that return count information.

Author:
trevor
See Also:
ExtentIterator

Constructor Summary
CountIterator()
           
 
Method Summary
 int compareTo(CountIterator other)
          Compares the current document of two iterators.
abstract  int count()
          Returns the number of occurrences of this iterator's term in the current document.
abstract  int document()
          Returns the current document.
abstract  boolean isDone()
          Returns true if there is no data left in the list and false otherwise.
abstract  void nextDocument()
          Moves the iterator to the next document in the list.
abstract  void reset()
          Resets the position of this iterator to the start of the list.
 boolean skipToDocument(int document)
          Skips forward in the list until a document is found that is greater than or equal to the parameter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CountIterator

public CountIterator()
Method Detail

skipToDocument

public boolean skipToDocument(int document)
                       throws java.io.IOException
Skips forward in the list until a document is found that is greater than or equal to the parameter. If the iterator is currently pointing to a document that is greater than or equal to the parameter, nothing happens.

Returns:
true, if the iterator is now pointing at the desired document, or false otherwise.
Throws:
java.io.IOException

nextDocument

public abstract void nextDocument()
                           throws java.io.IOException
Moves the iterator to the next document in the list. If no such document is available, isDone() will return true after this method is called.

Throws:
java.io.IOException

document

public abstract int document()
Returns the current document.


count

public abstract int count()
Returns the number of occurrences of this iterator's term in the current document.


isDone

public abstract boolean isDone()
Returns true if there is no data left in the list and false otherwise. If the result of this method is true, the data returned from document() and count() is meaningless.


reset

public abstract void reset()
                    throws java.io.IOException
Resets the position of this iterator to the start of the list.

Specified by:
reset in interface StructuredIterator
Throws:
java.io.IOException

compareTo

public int compareTo(CountIterator other)
Compares the current document of two iterators. This is primarily useful for adding iterators to a PriorityQueue object for use during retrieval.

Specified by:
compareTo in interface java.lang.Comparable<CountIterator>
See Also:
PriorityQueue


Copyright © 2009. All Rights Reserved.