org.apache.lucene.mark
Class MarkPos

Object
  extended by MarkPos
All Implemented Interfaces:
Cloneable
Direct Known Subclasses:
BasicMarkPos, ChunkMarkPos

public abstract class MarkPos
extends Object
implements Cloneable

Represents an abstract position within the text of a document. Provides methods to get the integer word position, and to count/extract text between this position and another position. Derived classes store additional information specific to certain types of documents.

Created: Dec 14, 2004

Author:
Martin Haye

Constructor Summary
MarkPos()
           
 
Method Summary
 Object clone()
          Make an exact copy of this object
abstract  int countTextTo(MarkPos other)
          Counts the number of characters of text starting at this position and ending at another position.
abstract  String getTextTo(MarkPos other)
          Retrieves all the text starting at this position and ending at another position.
abstract  int wordPos()
          Retrieves the absolute position (in number of words) from the start of the document or field.
 
Methods inherited from class Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MarkPos

public MarkPos()
Method Detail

clone

public Object clone()
Make an exact copy of this object

Overrides:
clone in class Object

wordPos

public abstract int wordPos()
Retrieves the absolute position (in number of words) from the start of the document or field. Not the same as the count of tokens, since not all tokens have getPositionIncrement() equal to 1.


countTextTo

public abstract int countTextTo(MarkPos other)
Counts the number of characters of text starting at this position and ending at another position. It is an error if they are out of order.


getTextTo

public abstract String getTextTo(MarkPos other)
Retrieves all the text starting at this position and ending at another position. It is an error if they are out of order.