Fork me on GitHub
  • API

    Show / Hide Table of Contents

    Class CharTermAttribute

    Default implementation of ICharTermAttribute.

    Inheritance
    object
    Attribute
    CharTermAttribute
    Token
    Implements
    ICharTermAttribute
    ICharSequence
    ITermToBytesRefAttribute
    IAttribute
    IAppendable
    Inherited Members
    Attribute.ReflectAsString(bool)
    object.Equals(object, object)
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    Namespace: Lucene.Net.Analysis.TokenAttributes
    Assembly: Lucene.Net.dll
    Syntax
    public class CharTermAttribute : Attribute, ICharTermAttribute, ICharSequence, ITermToBytesRefAttribute, IAttribute, IAppendable

    Constructors

    CharTermAttribute()

    Initialize this attribute with empty term text

    Declaration
    public CharTermAttribute()

    Properties

    Buffer

    Default implementation of ICharTermAttribute.

    Declaration
    public char[] Buffer { get; }
    Property Value
    Type Description
    char[]

    BytesRef

    Retrieve this attribute's BytesRef. The bytes are updated from the current term when the consumer calls FillBytesRef().

    Declaration
    public virtual BytesRef BytesRef { get; }
    Property Value
    Type Description
    BytesRef

    this IAttributes internal BytesRef.

    this[int]

    Default implementation of ICharTermAttribute.

    Declaration
    public char this[int index] { get; set; }
    Parameters
    Type Name Description
    int index
    Property Value
    Type Description
    char

    Length

    Default implementation of ICharTermAttribute.

    Declaration
    public int Length { get; set; }
    Property Value
    Type Description
    int

    Methods

    Append(ICharSequence)

    Default implementation of ICharTermAttribute.

    Declaration
    public CharTermAttribute Append(ICharSequence value)
    Parameters
    Type Name Description
    ICharSequence value
    Returns
    Type Description
    CharTermAttribute

    Append(ICharSequence, int, int)

    Default implementation of ICharTermAttribute.

    Declaration
    public CharTermAttribute Append(ICharSequence value, int startIndex, int charCount)
    Parameters
    Type Name Description
    ICharSequence value
    int startIndex
    int charCount
    Returns
    Type Description
    CharTermAttribute

    Append(ICharTermAttribute)

    Default implementation of ICharTermAttribute.

    Declaration
    public CharTermAttribute Append(ICharTermAttribute value)
    Parameters
    Type Name Description
    ICharTermAttribute value
    Returns
    Type Description
    CharTermAttribute

    Append(char)

    Default implementation of ICharTermAttribute.

    Declaration
    public CharTermAttribute Append(char value)
    Parameters
    Type Name Description
    char value
    Returns
    Type Description
    CharTermAttribute

    Append(char[])

    Default implementation of ICharTermAttribute.

    Declaration
    public CharTermAttribute Append(char[] value)
    Parameters
    Type Name Description
    char[] value
    Returns
    Type Description
    CharTermAttribute

    Append(char[], int, int)

    Default implementation of ICharTermAttribute.

    Declaration
    public CharTermAttribute Append(char[] value, int startIndex, int charCount)
    Parameters
    Type Name Description
    char[] value
    int startIndex
    int charCount
    Returns
    Type Description
    CharTermAttribute

    Append(string)

    Default implementation of ICharTermAttribute.

    Declaration
    public CharTermAttribute Append(string value)
    Parameters
    Type Name Description
    string value
    Returns
    Type Description
    CharTermAttribute

    Append(string, int, int)

    Default implementation of ICharTermAttribute.

    Declaration
    public CharTermAttribute Append(string value, int startIndex, int charCount)
    Parameters
    Type Name Description
    string value
    int startIndex
    int charCount
    Returns
    Type Description
    CharTermAttribute

    Append(StringBuilder)

    Default implementation of ICharTermAttribute.

    Declaration
    public CharTermAttribute Append(StringBuilder value)
    Parameters
    Type Name Description
    StringBuilder value
    Returns
    Type Description
    CharTermAttribute

    Append(StringBuilder, int, int)

    Default implementation of ICharTermAttribute.

    Declaration
    public CharTermAttribute Append(StringBuilder value, int startIndex, int charCount)
    Parameters
    Type Name Description
    StringBuilder value
    int startIndex
    int charCount
    Returns
    Type Description
    CharTermAttribute

    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
    Attribute.Clear()

    Clone()

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

    Declaration
    public override object Clone()
    Returns
    Type Description
    object
    Overrides
    Attribute.Clone()

    CopyBuffer(char[], int, int)

    Default implementation of ICharTermAttribute.

    Declaration
    public void CopyBuffer(char[] buffer, int offset, int length)
    Parameters
    Type Name Description
    char[] buffer
    int offset
    int length

    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
    Attribute.CopyTo(IAttribute)

    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
    object.Equals(object)

    FillBytesRef()

    Updates the bytes BytesRef to contain this term's final encoding.

    Declaration
    public virtual void FillBytesRef()

    GetHashCode()

    Serves as the default hash function.

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    int

    A hash code for the current object.

    Overrides
    object.GetHashCode()

    ReflectWith(IAttributeReflector)

    This method is for introspection of attributes, it should simply add the key/values this attribute holds to the given IAttributeReflector.

    The default implementation calls Reflect(Type, string, object) for all non-static fields from the implementing class, using the field name as key and the field value as value. The IAttribute class is also determined by Reflection. Please note that the default implementation can only handle single-Attribute implementations.

    Custom implementations look like this (e.g. for a combined attribute implementation):
    public void ReflectWith(IAttributeReflector reflector) 
    {
        reflector.Reflect(typeof(ICharTermAttribute), "term", GetTerm());
        reflector.Reflect(typeof(IPositionIncrementAttribute), "positionIncrement", GetPositionIncrement());
    }

    If you implement this method, make sure that for each invocation, the same set of IAttribute interfaces and keys are passed to Reflect(Type, string, object) in the same order, but possibly different values. So don't automatically exclude e.g. null properties!
    Declaration
    public override void ReflectWith(IAttributeReflector reflector)
    Parameters
    Type Name Description
    IAttributeReflector reflector
    Overrides
    Attribute.ReflectWith(IAttributeReflector)
    See Also
    ReflectAsString(bool)

    ResizeBuffer(int)

    Default implementation of ICharTermAttribute.

    Declaration
    public char[] ResizeBuffer(int newSize)
    Parameters
    Type Name Description
    int newSize
    Returns
    Type Description
    char[]

    SetEmpty()

    Default implementation of ICharTermAttribute.

    Declaration
    public CharTermAttribute SetEmpty()
    Returns
    Type Description
    CharTermAttribute

    SetLength(int)

    Default implementation of ICharTermAttribute.

    Declaration
    public CharTermAttribute SetLength(int length)
    Parameters
    Type Name Description
    int length
    Returns
    Type Description
    CharTermAttribute

    Subsequence(int, int)

    Retrieves a sub-sequence from this instance. The sub-sequence starts at a specified character position and has a specified length.

    IMPORTANT: This method has .NET semantics, that is, the second parameter is a length, not an exclusive end index as it would be in Java. To translate from Java to .NET, callers must account for this by subtracting (end - start) for the length.
    Declaration
    public ICharSequence Subsequence(int startIndex, int length)
    Parameters
    Type Name Description
    int startIndex

    The start index of the sub-sequence. It is inclusive, that is, the index of the first character that is included in the sub-sequence.

    int length

    The number of characters to return in the sub-sequence.

    Returns
    Type Description
    ICharSequence
    Exceptions
    Type Condition
    ArgumentOutOfRangeException

    startIndex plus length indicates a position not within this instance.

    -or-

    startIndex or length is less than zero.

    ToString()

    Returns solely the term text as specified by the J2N.Text.ICharSequence interface.

    this method changed the behavior with Lucene 3.1, before it returned a String representation of the whole term with all attributes. this affects especially the Token subclass.
    Declaration
    public override string ToString()
    Returns
    Type Description
    string
    Overrides
    Attribute.ToString()

    Implements

    ICharTermAttribute
    J2N.Text.ICharSequence
    ITermToBytesRefAttribute
    IAttribute
    J2N.Text.IAppendable
    Back to top Copyright © 2024 The Apache Software Foundation, Licensed under the Apache License, Version 2.0
    Apache Lucene.Net, Lucene.Net, Apache, the Apache feather logo, and the Apache Lucene.Net project logo are trademarks of The Apache Software Foundation.
    All other marks mentioned may be trademarks or registered trademarks of their respective owners.