Class OffsetAttribute
Default implementation of IOffsetAttribute.
Inherited Members
Namespace: Lucene.Net.Analysis.TokenAttributes
Assembly: Lucene.Net.dll
Syntax
public class OffsetAttribute : Attribute, IOffsetAttribute, IAttribute
Constructors
OffsetAttribute()
Initialize this attribute with startOffset and endOffset of 0.
Declaration
public OffsetAttribute()
Properties
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).
Declaration
public virtual int EndOffset { get; }
Property Value
Type | Description |
---|---|
int |
See Also
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.Declaration
public virtual int StartOffset { get; }
Property Value
Type | Description |
---|---|
int |
See Also
Methods
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.
Declaration
public override void Clear()
Overrides
CopyTo(IAttribute)
Copies the values from this Attribute into the passed-in
target
attribute. The target
implementation must support all the
IAttributes this implementation supports.
Declaration
public override void CopyTo(IAttribute target)
Parameters
Type | Name | Description |
---|---|---|
IAttribute | target |
Overrides
Equals(object)
Determines whether the specified object is equal to the current object.
Declaration
public override bool Equals(object other)
Parameters
Type | Name | Description |
---|---|---|
object | other |
Returns
Type | Description |
---|---|
bool | true if the specified object is equal to the current object; otherwise, false. |
Overrides
GetHashCode()
Serves as the default hash function.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
int | A hash code for the current object. |
Overrides
SetOffset(int, int)
Set the starting and ending offset.
Declaration
public virtual void SetOffset(int startOffset, int endOffset)
Parameters
Type | Name | Description |
---|---|---|
int | startOffset | |
int | endOffset |
Exceptions
Type | Condition |
---|---|
ArgumentException | If |