Class CharTermAttribute
Inheritance
CharTermAttribute
Implements
ICharSequence
IAppendable
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
Declaration
public char[] Buffer { get; }
Property Value
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
this[int]
Declaration
public char this[int index] { get; set; }
Parameters
Type |
Name |
Description |
int |
index |
|
Property Value
Length
Declaration
public int Length { get; set; }
Property Value
Methods
Append(ICharSequence)
Declaration
public CharTermAttribute Append(ICharSequence value)
Parameters
Type |
Name |
Description |
ICharSequence |
value |
|
Returns
Append(ICharSequence, int, int)
Declaration
public CharTermAttribute Append(ICharSequence value, int startIndex, int charCount)
Parameters
Type |
Name |
Description |
ICharSequence |
value |
|
int |
startIndex |
|
int |
charCount |
|
Returns
Append(ICharTermAttribute)
Declaration
public CharTermAttribute Append(ICharTermAttribute value)
Parameters
Returns
Append(char)
Declaration
public CharTermAttribute Append(char value)
Parameters
Type |
Name |
Description |
char |
value |
|
Returns
Append(char[])
Declaration
public CharTermAttribute Append(char[] value)
Parameters
Type |
Name |
Description |
char[] |
value |
|
Returns
Append(char[], int, int)
Declaration
public CharTermAttribute Append(char[] value, int startIndex, int charCount)
Parameters
Type |
Name |
Description |
char[] |
value |
|
int |
startIndex |
|
int |
charCount |
|
Returns
Append(string)
Declaration
public CharTermAttribute Append(string value)
Parameters
Type |
Name |
Description |
string |
value |
|
Returns
Append(string, int, int)
Declaration
public CharTermAttribute Append(string value, int startIndex, int charCount)
Parameters
Type |
Name |
Description |
string |
value |
|
int |
startIndex |
|
int |
charCount |
|
Returns
Append(StringBuilder)
Declaration
public CharTermAttribute Append(StringBuilder value)
Parameters
Returns
Append(StringBuilder, int, int)
Declaration
public CharTermAttribute Append(StringBuilder value, int startIndex, int charCount)
Parameters
Returns
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
Clone()
Shallow clone. Subclasses must override this if they
need to clone any members deeply,
Declaration
public override object Clone()
Returns
Overrides
CopyBuffer(char[], int, int)
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
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
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
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
Overrides
See Also
ResizeBuffer(int)
Declaration
public char[] ResizeBuffer(int newSize)
Parameters
Type |
Name |
Description |
int |
newSize |
|
Returns
SetEmpty()
Declaration
public CharTermAttribute SetEmpty()
Returns
SetLength(int)
Declaration
public CharTermAttribute SetLength(int length)
Parameters
Type |
Name |
Description |
int |
length |
|
Returns
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
Overrides
Implements
J2N.Text.ICharSequence
J2N.Text.IAppendable