org.apache.lucene.index

Class TermEnum

public abstract class TermEnum extends Object

Abstract class for enumerating terms.

Term enumerations are always ordered by Term.compareTo(). Each term in the enumeration is greater than all that precede it.

Method Summary
abstract voidclose()
Closes the enumeration to further activity, freeing resources.
abstract intdocFreq()
Returns the docFreq of the current Term in the enumeration.
abstract booleannext()
Increments the enumeration to the next element.
booleanskipTo(Term target)
Skips terms to the first beyond the current whose value is greater or equal to target.
abstract Termterm()
Returns the current Term in the enumeration.

Method Detail

close

public abstract void close()
Closes the enumeration to further activity, freeing resources.

docFreq

public abstract int docFreq()
Returns the docFreq of the current Term in the enumeration.

next

public abstract boolean next()
Increments the enumeration to the next element. True if one exists.

skipTo

public boolean skipTo(Term target)
Skips terms to the first beyond the current whose value is greater or equal to target.

Returns true iff there is such an entry.

Behaves as if written:

   public boolean skipTo(Term target) {
     do {
       if (!next())
 	     return false;
     } while (target > term());
     return true;
   }
 
Some implementations are considerably more efficient than that.

term

public abstract Term term()
Returns the current Term in the enumeration.
Copyright © 2000-2007 Apache Software Foundation. All Rights Reserved.