Overview | Package | Class | Use | Tree | Deprecated | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.lucene.analysis.tokenattributes
Interface OffsetAttribute

All Superinterfaces:
  Attribute

All Known Implementing Classes:
  OffsetAttributeImpl, Token

    public interface OffsetAttribute

extends Attribute

The start and end character offset of a Token.

Method Summary
`int` | `endOffset()` Returns this Token's ending offset, one greater than the position of the last character corresponding to this token in the source text.
`void` | `setOffset(int startOffset, int endOffset)` Set the starting and ending offset.
`int` | `startOffset()` Returns this Token's starting offset, the position of the first character corresponding to this token in the source text.

Method Detail

### startOffset

    int startOffset()

  Returns this Token's starting offset, the position of the first character corresponding to this token in the source text.

  Note that the difference between `endOffset()` and `startOffset()` may not be equal to termText.length(), as the term text may have been altered by a stemmer or some other filter.

  See Also:
    `setOffset(int, int)`

### setOffset

    void setOffset(int startOffset,
                   int endOffset)

  Set the starting and ending offset.

  Throws:
    `IllegalArgumentException` - If `startOffset` or `endOffset` are negative, or if `startOffset` is greater than `endOffset`
  See Also:
    `startOffset()`, `endOffset()`

### endOffset

    int endOffset()

  Returns this Token's ending offset, one greater than the position of the last character corresponding to this token in the source text. The length of the token in the source text is (`endOffset()` - `startOffset()`).

  See Also:
    `setOffset(int, int)`

Overview | Package | Class | Use | Tree | Deprecated | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000-2013 Apache Software Foundation. All Rights Reserved.