Lucene++ - a full-featured, c++ search engine
API Documentation

Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Protected Attributes
Lucene::OffsetAttribute Class Reference

The start and end character offset of a Token. More...

`#include <OffsetAttribute.h>`

Inheritance diagram for Lucene::OffsetAttribute:

## Public Member Functions

| OffsetAttribute ()
virtual | ~OffsetAttribute ()
virtual String | getClassName ()
boost::shared_ptr< OffsetAttribute > | shared_from_this ()
virtual String | toString ()
| Returns a string representation of the object.
virtual int32_t | startOffset ()
| Returns this Token's starting offset, the position of the first character corresponding to this token in the source text.
virtual void | setOffset (int32_t startOffset, int32_t endOffset)
| Set the starting and ending offset.
virtual int32_t | 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).
virtual void | clear ()
| Clears the values in this Attribute and resets it to its default value. If this implementation implements more than one Attribute interface it clears all.
virtual bool | equals (const LuceneObjectPtr &other)
| All values used for computation of `hashCode()` should be checked here for equality.
virtual int32_t | hashCode ()
| Subclasses must implement this method and should compute a hashCode similar to this:
virtual void | copyTo (const AttributePtr &target)
| Copies the values from this Attribute into the passed-in target attribute. The target implementation must support all the Attributes this implementation supports.
virtual LuceneObjectPtr | clone (const LuceneObjectPtr &other=LuceneObjectPtr())
| Shallow clone. Subclasses must override this if they need to clone any members deeply.
Public Member Functions inherited from Lucene::Attribute
virtual | ~Attribute ()
boost::shared_ptr< Attribute > | shared_from_this ()
Public Member Functions inherited from Lucene::LuceneObject
virtual | ~LuceneObject ()
virtual void | initialize ()
| Called directly after instantiation to create objects that depend on this object being fully constructed.
virtual int32_t | compareTo (const LuceneObjectPtr &other)
| Compare two objects.
Public Member Functions inherited from Lucene::LuceneSync
virtual | ~LuceneSync ()
virtual SynchronizePtr | getSync ()
| Return this object synchronize lock.
virtual LuceneSignalPtr | getSignal ()
| Return this object signal.
virtual void | lock (int32_t timeout=0)
| Lock this object using an optional timeout.
virtual void | unlock ()
| Unlock this object.
virtual bool | holdsLock ()
| Returns true if this object is currently locked by current thread.
virtual void | wait (int32_t timeout=0)
| Wait for signal using an optional timeout.
virtual void | notifyAll ()
| Notify all threads waiting for signal.

## Static Public Member Functions

static String | _getClassName ()
Static Public Member Functions inherited from Lucene::Attribute
static String | _getClassName ()

## Protected Attributes

int32_t | _startOffset
int32_t | _endOffset
Protected Attributes inherited from Lucene::LuceneSync
SynchronizePtr | objectLock
LuceneSignalPtr | objectSignal

## Additional Inherited Members

Protected Member Functions inherited from Lucene::LuceneObject
| LuceneObject ()

## Detailed Description

The start and end character offset of a Token.

## Constructor & Destructor Documentation

## ◆ OffsetAttribute()

Lucene::OffsetAttribute::OffsetAttribute | ( |  | ) |

## ◆ ~OffsetAttribute()

virtual Lucene::OffsetAttribute::~OffsetAttribute | ( |  | ) |

virtual

## Member Function Documentation

## ◆ _getClassName()

static String Lucene::OffsetAttribute::_getClassName | ( |  | ) |

inline static

## ◆ clear()

virtual void Lucene::OffsetAttribute::clear | ( |  | ) |

virtual

Clears the values in this Attribute and resets it to its default value. If this implementation implements more than one Attribute interface it clears all.

Implements Lucene::Attribute.

## ◆ clone()

virtual LuceneObjectPtr Lucene::OffsetAttribute::clone | ( | const LuceneObjectPtr & | other = `LuceneObjectPtr()` | ) |

virtual

Shallow clone. Subclasses must override this if they need to clone any members deeply.

Parameters

  base | clone reference - null when called initially, then set in top virtual override.

Implements Lucene::Attribute.

## ◆ copyTo()

virtual void Lucene::OffsetAttribute::copyTo | ( | const AttributePtr & | target | ) |

virtual

Copies the values from this Attribute into the passed-in target attribute. The target implementation must support all the Attributes this implementation supports.

Implements Lucene::Attribute.

## ◆ endOffset()

virtual int32_t Lucene::OffsetAttribute::endOffset | ( |  | ) |

virtual

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).

## ◆ equals()

virtual bool Lucene::OffsetAttribute::equals | ( | const LuceneObjectPtr & | other | ) |

virtual

All values used for computation of `hashCode()` should be checked here for equality.

see also `LuceneObject#equals(Object)`

Implements Lucene::Attribute.

## ◆ getClassName()

virtual String Lucene::OffsetAttribute::getClassName | ( |  | ) |

inline virtual

Reimplemented from Lucene::Attribute.

## ◆ hashCode()

virtual int32_t Lucene::OffsetAttribute::hashCode | ( |  | ) |

virtual

Subclasses must implement this method and should compute a hashCode similar to this:

int32_t hashCode() { int32_t code = startOffset; code = code * 31 + endOffset; return code; }

see also `equals(Object)`

Implements Lucene::Attribute.

## ◆ setOffset()

virtual void Lucene::OffsetAttribute::setOffset | ( | int32_t | startOffset,
|  | int32_t | endOffset
| ) |  |

virtual

Set the starting and ending offset.

See also
  startOffset() and endOffset()

## ◆ shared_from_this()

boost::shared_ptr< OffsetAttribute > Lucene::OffsetAttribute::shared_from_this | ( |  | ) |

inline

## ◆ startOffset()

virtual int32_t Lucene::OffsetAttribute::startOffset | ( |  | ) |

virtual

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.

## ◆ toString()

virtual String Lucene::OffsetAttribute::toString | ( |  | ) |

virtual

Returns a string representation of the object.

Reimplemented from Lucene::LuceneObject.

## Field Documentation

## ◆ _endOffset

int32_t Lucene::OffsetAttribute::_endOffset

protected

## ◆ _startOffset

int32_t Lucene::OffsetAttribute::_startOffset

protected

The documentation for this class was generated from the following file:

- OffsetAttribute.h

clucene.sourceforge.net