org.apache.lucene.search.spans
Class EmptySpans

Object
  extended by EmptySpans
All Implemented Interfaces:
Spans

public class EmptySpans
extends Object
implements Spans

Expert: An empty list of spans, suitable for ORing with other lists.


Field Summary
static EmptySpans theInstance
          Static instance; there's no need to ever create a new EmptySpans()
 
Constructor Summary
private EmptySpans()
          Don't create a new instance... use theInstance.
 
Method Summary
 void collectTerms(Set terms)
           
 int doc()
          Returns the document number of the current match.
 int end()
          Returns the end position of the current match.
 Explanation explain()
          Returns an explanation of how the score was arrived at.
 boolean next()
          Move to the next match, returning true iff any such exists.
 float score()
          Returns the score of the current match.
 boolean skipTo(int target)
          Skips to the first match beyond the current, whose document number is greater than or equal to target.
 int start()
          Returns the start position of the current match.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

theInstance

public static EmptySpans theInstance
Static instance; there's no need to ever create a new EmptySpans()

Constructor Detail

EmptySpans

private EmptySpans()
Don't create a new instance... use theInstance.

Method Detail

next

public boolean next()
             throws IOException
Description copied from interface: Spans
Move to the next match, returning true iff any such exists.

Specified by:
next in interface Spans
Throws:
IOException

skipTo

public boolean skipTo(int target)
               throws IOException
Description copied from interface: Spans
Skips to the first match beyond the current, whose document number is greater than or equal to target.

Returns true iff there is such a match.

Behaves as if written:

   boolean skipTo(int target) {
     do {
       if (!next())
              return false;
     } while (target > doc());
     return true;
   }
 
Most implementations are considerably more efficient than that.

Specified by:
skipTo in interface Spans
Throws:
IOException

doc

public int doc()
Description copied from interface: Spans
Returns the document number of the current match. Initially invalid.

Specified by:
doc in interface Spans

start

public int start()
Description copied from interface: Spans
Returns the start position of the current match. Initially invalid.

Specified by:
start in interface Spans

end

public int end()
Description copied from interface: Spans
Returns the end position of the current match. Initially invalid.

Specified by:
end in interface Spans

score

public float score()
Description copied from interface: Spans
Returns the score of the current match. Initially invalid.

Specified by:
score in interface Spans

collectTerms

public void collectTerms(Set terms)

explain

public Explanation explain()
Description copied from interface: Spans
Returns an explanation of how the score was arrived at. Initially invalid.

Specified by:
explain in interface Spans