// ----------------------------------------------------------------------- // // // Licensed to the Apache Software Foundation (ASF) under one or more // contributor license agreements. See the NOTICE file distributed with // this work for additional information regarding copyright ownership. // The ASF licenses this file to You under the Apache License, Version 2.0 // (the "License"); you may not use this file except in compliance with // the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // // // ----------------------------------------------------------------------- namespace Lucene.Net.Analysis.TokenAttributes { using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Text; using Util; /// /// The term text of a Token. /// /// /// /// /// Java File: /// lucene/src/java/org/apache/lucene/analysis/tokenattributes/CharTermAttribute.java /// /// /// /// C# File: /// src/Lucene.Net/Analysis/TokenAttributes/ICharTermAttribute.cs /// /// /// /// [SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix", Justification = "The class was called Attribute in Java. It would be fun to call it Annotation. However, " + "its probably best to try to honor the correlating names when possible.")] public interface ICharTermAttribute : IAttribute { /// /// Gets the internal termBuffer character array which you can then /// directly alter. /// /// /// /// If the array is too small for the token, use /// to increase the size. After altering the buffer be sure to call /// to record the valid characters that /// were placed into the termBuffer. /// /// /// The buffer. IEnumerable Buffer { get; } /// /// Gets or sets the number of valid characters, the length of the term, in /// the termBuffer array. /// /// /// /// Use this to truncate the termBuffer or to synchronize any external /// manipulation of the termBuffer. /// /// /// To grow the size of the array, use first. /// /// int Length { get; set; } /// /// Appends the specified value. /// /// The value. /// /// An instance of for fluent interface /// chaining purposes. /// ICharTermAttribute Append(char value); /// /// Appends the specified to internal buffer or character sequence. /// /// The value. /// /// An instance of for fluent interface /// chaining purposes. /// ICharTermAttribute Append(string value); /// /// Appends the specified to internal buffer or character sequence. /// /// The value. /// the index of string to start the copy. /// The length of the string that is to be copied. /// /// An instance of for fluent interface /// chaining purposes. /// ICharTermAttribute Append(string value, int startingIndex, int length); /// /// Appends the specified value. /// /// The value. /// /// An instance of for fluent interface /// chaining purposes. /// ICharTermAttribute Append(StringBuilder value); /// /// Appends the specified value. /// /// The value. /// /// An instance of for fluent interface /// chaining purposes. /// ICharTermAttribute Append(ICharTermAttribute value); /// /// Copies the contents of the buffer, starting at the offset to the specified length. /// /// The buffer to copy. /// The index of the first character to copy inside the buffer. /// The number of characters to copy, if -1 the length will default to the buffer length. void CopyBuffer(char[] buffer, int offset = 0, int length = -1); /// /// Sets the length of the internal buffer to zero. User this /// method before appending content using Append methods. /// /// /// An instance of for fluent interface /// chaining purposes. /// ICharTermAttribute Empty(); /// /// Resizes the buffer. /// /// The length. /// An instance of . IEnumerable ResizeBuffer(int length); /// /// Gets or sets the number of valid characters, the length of the term, in /// the termBuffer array. /// /// /// /// Use this to truncate the termBuffer or to synchronize any external /// manipulation of the termBuffer. /// /// /// To grow the size of the array, use first. /// /// /// The length. /// /// An instance of for fluent interface /// chaining purposes. /// ICharTermAttribute SetLength(int length); } }