Fork me on GitHub
  • API

    Show / Hide Table of Contents

    Class CharsRef

    Represents char[], as a slice (offset + Length) into an existing char[]. The Chars property should never be null; use EMPTY_CHARS if necessary.

    Note

    This API is for internal purposes only and might change in incompatible ways in the next release.

    Inheritance
    object
    CharsRef
    Implements
    IComparable<CharsRef>
    ICharSequence
    IEquatable<CharsRef>
    Inherited Members
    object.Equals(object, object)
    object.GetType()
    object.ReferenceEquals(object, object)
    Namespace: Lucene.Net.Util
    Assembly: Lucene.Net.dll
    Syntax
    [Serializable]
    public sealed class CharsRef : IComparable<CharsRef>, ICharSequence, IEquatable<CharsRef>

    Constructors

    CharsRef()

    Creates a new CharsRef initialized an empty array zero-Length

    Declaration
    public CharsRef()

    CharsRef(char[], int, int)

    Creates a new CharsRef initialized with the given chars, offset and length.

    Declaration
    public CharsRef(char[] chars, int offset, int length)
    Parameters
    Type Name Description
    char[] chars
    int offset
    int length

    CharsRef(int)

    Creates a new CharsRef initialized with an array of the given capacity.

    Declaration
    public CharsRef(int capacity)
    Parameters
    Type Name Description
    int capacity

    CharsRef(string)

    Creates a new CharsRef initialized with the given string character array.

    Declaration
    public CharsRef(string @string)
    Parameters
    Type Name Description
    string string

    Fields

    EMPTY_CHARS

    An empty character array for convenience

    Declaration
    public static readonly char[] EMPTY_CHARS
    Field Value
    Type Description
    char[]

    Properties

    Chars

    The contents of the CharsRef. Should never be null.

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

    this[int]

    Gets the character at the specified index, with the first character having index zero.

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

    The index of the character to return.

    Property Value
    Type Description
    char

    The requested character.

    Exceptions
    Type Condition
    IndexOutOfRangeException

    If index < 0 or index is greater than the length of this sequence.

    InvalidOperationException

    If the underlying value of this sequence is null.

    Length

    Length of used characters.

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

    Offset

    Offset of first valid character.

    Declaration
    public int Offset { get; }
    Property Value
    Type Description
    int

    UTF16SortedAsUTF8Comparer

    Represents char[], as a slice (offset + Length) into an existing char[]. The Chars property should never be null; use EMPTY_CHARS if necessary.

    Note

    This API is for internal purposes only and might change in incompatible ways in the next release.

    Declaration
    [Obsolete("this comparer is only a transition mechanism")]
    public static IComparer<CharsRef> UTF16SortedAsUTF8Comparer { get; }
    Property Value
    Type Description
    IComparer<CharsRef>

    Methods

    Append(char[], int, int)

    Appends the given array to this CharsRef.

    Declaration
    public void Append(char[] otherChars, int otherOffset, int otherLength)
    Parameters
    Type Name Description
    char[] otherChars
    int otherOffset
    int otherLength

    CharsEquals(CharsRef)

    Represents char[], as a slice (offset + Length) into an existing char[]. The Chars property should never be null; use EMPTY_CHARS if necessary.

    Note

    This API is for internal purposes only and might change in incompatible ways in the next release.

    Declaration
    public bool CharsEquals(CharsRef other)
    Parameters
    Type Name Description
    CharsRef other
    Returns
    Type Description
    bool

    Clone()

    Returns a shallow clone of this instance (the underlying characters are not copied and will be shared by both the returned object and this object.

    Declaration
    public object Clone()
    Returns
    Type Description
    object
    See Also
    DeepCopyOf(CharsRef)

    CompareTo(CharsRef)

    Signed int order comparison

    Declaration
    public int CompareTo(CharsRef other)
    Parameters
    Type Name Description
    CharsRef other
    Returns
    Type Description
    int

    CopyChars(CharsRef)

    Copies the given CharsRef referenced content into this instance.

    Declaration
    public void CopyChars(CharsRef other)
    Parameters
    Type Name Description
    CharsRef other

    The CharsRef to copy.

    CopyChars(char[], int, int)

    Copies the given array into this CharsRef.

    Declaration
    public void CopyChars(char[] otherChars, int otherOffset, int otherLength)
    Parameters
    Type Name Description
    char[] otherChars
    int otherOffset
    int otherLength

    DeepCopyOf(CharsRef)

    Creates a new CharsRef that points to a copy of the chars from other.

    The returned CharsRef will have a Length of other.Length and an offset of zero.
    Declaration
    public static CharsRef DeepCopyOf(CharsRef other)
    Parameters
    Type Name Description
    CharsRef other
    Returns
    Type Description
    CharsRef

    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)

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

    Grow(int)

    Used to grow the reference array.

    In general this should not be used as it does not take the offset into account.

    Note

    This API is for internal purposes only and might change in incompatible ways in the next release.

    Declaration
    public void Grow(int newLength)
    Parameters
    Type Name Description
    int newLength

    IsValid()

    Performs internal consistency checks. Always returns true (or throws InvalidOperationException)

    Declaration
    public bool IsValid()
    Returns
    Type Description
    bool

    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 a string that represents the current object.

    Declaration
    public override string ToString()
    Returns
    Type Description
    string

    A string that represents the current object.

    Overrides
    object.ToString()

    Implements

    IComparable<T>
    J2N.Text.ICharSequence
    IEquatable<T>
    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.