Show / Hide Table of Contents

    Class CharArraySet

    A simple class that stores s as char[]'s in a hash table. Note that this is not a general purpose class. For example, it cannot remove items from the set, nor does it resize its hash table to be smaller, etc. It is designed to be quick to test if a char[] is in the set without the necessity of converting it to a first.

    You must specify the required LuceneVersion compatibility when creating CharArraySet:

    • As of 3.1, supplementary characters are properly lowercased.
    Before 3.1 supplementary characters could not be lowercased correctly due to the lack of Unicode 4 support in JDK 1.4. To use instances of CharArraySet with the behavior before Lucene 3.1 pass a LuceneVersion to the constructors.

    Please note: This class implements but does not behave like it should in all cases. The generic type is , because you can add any object to it, that has a string representation (which is converted to a string). The add methods will use and store the result using a char[] buffer. The same behavior have the Contains(String) methods. The GetEnumerator() returns an IEnumerator{char[]}

    Inheritance
    System.Object
    CharArraySet
    Namespace: Lucene.Net.Analysis.Util
    Assembly: Lucene.Net.Analysis.Common.dll
    Syntax
    public class CharArraySet : ISet<string>

    Constructors

    | Improve this Doc View Source

    CharArraySet(LuceneVersion, ICollection<String>, Boolean)

    Creates a set from a collection of objects.

    Declaration
    public CharArraySet(LuceneVersion matchVersion, ICollection<string> c, bool ignoreCase)
    Parameters
    Type Name Description
    LuceneVersion matchVersion

    compatibility match version see CharArraySet for details.

    ICollection<System.String> c

    a collection whose elements to be placed into the set

    System.Boolean ignoreCase

    false if and only if the set should be case sensitive otherwise true.

    | Improve this Doc View Source

    CharArraySet(LuceneVersion, Int32, Boolean)

    Create set with enough capacity to hold startSize terms

    Declaration
    public CharArraySet(LuceneVersion matchVersion, int startSize, bool ignoreCase)
    Parameters
    Type Name Description
    LuceneVersion matchVersion

    compatibility match version see CharArraySet for details.

    System.Int32 startSize

    the initial capacity

    System.Boolean ignoreCase

    false if and only if the set should be case sensitive otherwise true.

    Fields

    | Improve this Doc View Source

    EMPTY_SET

    Declaration
    public static readonly CharArraySet EMPTY_SET
    Field Value
    Type Description
    CharArraySet

    Properties

    | Improve this Doc View Source

    Count

    Gets the number of elements contained in the CharArraySet.

    Declaration
    public virtual int Count { get; }
    Property Value
    Type Description
    System.Int32
    | Improve this Doc View Source

    IsReadOnly

    true if the CharArraySet is read-only; otherwise false.

    Declaration
    public virtual bool IsReadOnly { get; }
    Property Value
    Type Description
    System.Boolean

    Methods

    | Improve this Doc View Source

    Add(ICharSequence)

    Add this ICharSequence into the set

    Declaration
    public virtual bool Add(ICharSequence text)
    Parameters
    Type Name Description
    ICharSequence text
    Returns
    Type Description
    System.Boolean

    true if text was added to the set; false if it already existed prior to this call

    | Improve this Doc View Source

    Add(Char[])

    Add this char[] directly to the set. If ignoreCase is true for this CharArraySet, the text array will be directly modified. The user should never modify this text array after calling this method.

    Declaration
    public virtual bool Add(char[] text)
    Parameters
    Type Name Description
    System.Char[] text
    Returns
    Type Description
    System.Boolean

    true if text was added to the set; false if it already existed prior to this call

    | Improve this Doc View Source

    Add(Object)

    Add the representation of o into the set. The method is called after setting the thread to . If the type of o is a value type, it will be converted using the .

    Declaration
    public virtual bool Add(object o)
    Parameters
    Type Name Description
    System.Object o

    A string-able object

    Returns
    Type Description
    System.Boolean

    true if o was added to the set; false if it already existed prior to this call

    | Improve this Doc View Source

    Add(String)

    Add this into the set

    Declaration
    public virtual bool Add(string text)
    Parameters
    Type Name Description
    System.String text
    Returns
    Type Description
    System.Boolean

    true if text was added to the set; false if it already existed prior to this call

    | Improve this Doc View Source

    Clear()

    Clears all entries in this set. This method is supported for reusing, but not ICollection{string}.Remove(string).

    Declaration
    public virtual void Clear()
    | Improve this Doc View Source

    Contains(ICharSequence)

    true if the ICharSequence is in the set

    Declaration
    public virtual bool Contains(ICharSequence cs)
    Parameters
    Type Name Description
    ICharSequence cs
    Returns
    Type Description
    System.Boolean
    | Improve this Doc View Source

    Contains(Char[])

    true if the char[]s are in the set

    Declaration
    public virtual bool Contains(char[] text)
    Parameters
    Type Name Description
    System.Char[] text
    Returns
    Type Description
    System.Boolean
    | Improve this Doc View Source

    Contains(Char[], Int32, Int32)

    true if the length chars of text starting at offset are in the set

    Declaration
    public virtual bool Contains(char[] text, int offset, int length)
    Parameters
    Type Name Description
    System.Char[] text
    System.Int32 offset
    System.Int32 length
    Returns
    Type Description
    System.Boolean
    | Improve this Doc View Source

    Contains(Object)

    true if the representation of o is in the set

    Declaration
    public virtual bool Contains(object o)
    Parameters
    Type Name Description
    System.Object o
    Returns
    Type Description
    System.Boolean
    | Improve this Doc View Source

    Contains(String)

    true if the is in the set

    Declaration
    public virtual bool Contains(string cs)
    Parameters
    Type Name Description
    System.String cs
    Returns
    Type Description
    System.Boolean
    | Improve this Doc View Source

    ContainsAll(IEnumerable<String>)

    Returns true if this collection contains all of the elements in the specified collection.

    Declaration
    public virtual bool ContainsAll(IEnumerable<string> other)
    Parameters
    Type Name Description
    IEnumerable<System.String> other

    collection to be checked for containment in this collection

    Returns
    Type Description
    System.Boolean

    true if this CharArraySet contains all of the elements in the specified collection; otherwise, false.

    | Improve this Doc View Source

    ContainsAll<T>(IEnumerable<T>)

    Returns true if this collection contains all of the elements in the specified collection.

    Declaration
    public virtual bool ContainsAll<T>(IEnumerable<T> other)
    Parameters
    Type Name Description
    IEnumerable<T> other

    collection to be checked for containment in this collection

    Returns
    Type Description
    System.Boolean

    true if this CharArraySet contains all of the elements in the specified collection; otherwise, false.

    Type Parameters
    Name Description
    T
    | Improve this Doc View Source

    Copy<T>(LuceneVersion, ICollection<T>)

    Returns a copy of the given set as a CharArraySet. If the given set is a CharArraySet the ignoreCase property will be preserved.

    Note: If you intend to create a copy of another CharArraySet where the LuceneVersion of the source set differs from its copy CharArraySet(LuceneVersion, ICollection<String>, Boolean) should be used instead. The Copy<T>(LuceneVersion, ICollection<T>) will preserve the LuceneVersion of the source set it is an instance of CharArraySet.

    Declaration
    public static CharArraySet Copy<T>(LuceneVersion matchVersion, ICollection<T> set)
    Parameters
    Type Name Description
    LuceneVersion matchVersion

    compatibility match version. This argument will be ignored if the given set is a CharArraySet.

    ICollection<T> set

    a set to copy

    Returns
    Type Description
    CharArraySet

    a copy of the given set as a CharArraySet. If the given set is a CharArraySet the Lucene.Net.Analysis.Util.CharArrayMap`1.ignoreCase field as well as the MatchVersion will be preserved.

    Type Parameters
    Name Description
    T
    | Improve this Doc View Source

    CopyTo(String[], Int32)

    Copies the entire CharArraySet to a one-dimensional string[] array, starting at the specified index of the target array.

    Declaration
    public void CopyTo(string[] array, int arrayIndex)
    Parameters
    Type Name Description
    System.String[] array

    The one-dimensional string[] Array that is the destination of the elements copied from CharArraySet. The Array must have zero-based indexing.

    System.Int32 arrayIndex

    The zero-based index in array at which copying begins.

    | Improve this Doc View Source

    Equals(Object)

    Compares the specified object with this set for equality. Returns true if the given object is also a set, the two sets have the same size, and every member of the given set is contained in this set. This ensures that the equals method works properly across different implementations of the ISet{string} interface.

    This implementation first checks if the specified object is this set; if so it returns true. Then, it checks if the specified object is a set whose size is identical to the size of this set; if not, it returns false. If so, it uses the enumerator of this set and the specified object to determine if all of the contained values are present (using ).

    Declaration
    public override bool Equals(object obj)
    Parameters
    Type Name Description
    System.Object obj

    object to be compared for equality with this set

    Returns
    Type Description
    System.Boolean

    true if the specified object is equal to this set

    | Improve this Doc View Source

    ExceptWith(IEnumerable<String>)

    Declaration
    public void ExceptWith(IEnumerable<string> other)
    Parameters
    Type Name Description
    IEnumerable<System.String> other
    | Improve this Doc View Source

    GetEnumerator()

    Returns an for char[] instances in this set.

    Declaration
    public virtual IEnumerator GetEnumerator()
    Returns
    Type Description
    IEnumerator
    | Improve this Doc View Source

    GetHashCode()

    Returns the hash code value for this set. The hash code of a set is defined to be the sum of the hash codes of the elements in the set, where the hash code of a null element is defined to be zero. This ensures that s1.Equals(s2) implies that s1.GetHashCode()==s2.GetHashCode() for any two sets s1 and s2. This implementation iterates over the set, calling the GetHashCode() method on each element in the set, and adding up the results.

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    System.Int32

    the hash code value for this set

    | Improve this Doc View Source

    IntersectWith(IEnumerable<String>)

    Declaration
    public void IntersectWith(IEnumerable<string> other)
    Parameters
    Type Name Description
    IEnumerable<System.String> other
    | Improve this Doc View Source

    IsProperSubsetOf(IEnumerable<String>)

    Determines whether a CharArraySet object is a proper subset of the specified collection.

    Declaration
    public virtual bool IsProperSubsetOf(IEnumerable<string> other)
    Parameters
    Type Name Description
    IEnumerable<System.String> other

    The collection to compare to the current CharArraySet object.

    Returns
    Type Description
    System.Boolean

    true if this CharArraySet object is a proper subset of other; otherwise, false.

    | Improve this Doc View Source

    IsProperSubsetOf<T>(IEnumerable<T>)

    Determines whether a CharArraySet object is a proper subset of the specified collection.

    Declaration
    public virtual bool IsProperSubsetOf<T>(IEnumerable<T> other)
    Parameters
    Type Name Description
    IEnumerable<T> other

    The collection to compare to the current CharArraySet object.

    Returns
    Type Description
    System.Boolean

    true if this CharArraySet object is a proper subset of other; otherwise, false.

    Type Parameters
    Name Description
    T
    | Improve this Doc View Source

    IsProperSupersetOf(IEnumerable<String>)

    Determines whether a CharArraySet object is a proper superset of the specified collection.

    Declaration
    public virtual bool IsProperSupersetOf(IEnumerable<string> other)
    Parameters
    Type Name Description
    IEnumerable<System.String> other

    The collection to compare to the current CharArraySet object.

    Returns
    Type Description
    System.Boolean

    true if this CharArraySet object is a proper superset of other; otherwise, false.

    | Improve this Doc View Source

    IsProperSupersetOf<T>(IEnumerable<T>)

    Determines whether a CharArraySet object is a proper superset of the specified collection.

    Declaration
    public virtual bool IsProperSupersetOf<T>(IEnumerable<T> other)
    Parameters
    Type Name Description
    IEnumerable<T> other

    The collection to compare to the current CharArraySet object.

    Returns
    Type Description
    System.Boolean

    true if this CharArraySet object is a proper superset of other; otherwise, false.

    Type Parameters
    Name Description
    T
    | Improve this Doc View Source

    IsSubsetOf(IEnumerable<String>)

    Determines whether a CharArraySet object is a subset of the specified collection.

    Declaration
    public virtual bool IsSubsetOf(IEnumerable<string> other)
    Parameters
    Type Name Description
    IEnumerable<System.String> other

    The collection to compare to the current CharArraySet object.

    Returns
    Type Description
    System.Boolean

    true if this CharArraySet object is a subset of other; otherwise, false.

    | Improve this Doc View Source

    IsSubsetOf<T>(IEnumerable<T>)

    Determines whether a CharArraySet object is a subset of the specified collection.

    Declaration
    public virtual bool IsSubsetOf<T>(IEnumerable<T> other)
    Parameters
    Type Name Description
    IEnumerable<T> other

    The collection to compare to the current CharArraySet object.

    Returns
    Type Description
    System.Boolean

    true if this CharArraySet object is a subset of other; otherwise, false.

    Type Parameters
    Name Description
    T
    | Improve this Doc View Source

    IsSupersetOf(IEnumerable<String>)

    Determines whether a CharArraySet object is a superset of the specified collection.

    Declaration
    public virtual bool IsSupersetOf(IEnumerable<string> other)
    Parameters
    Type Name Description
    IEnumerable<System.String> other

    The collection to compare to the current CharArraySet object.

    Returns
    Type Description
    System.Boolean

    true if this CharArraySet object is a superset of other; otherwise, false.

    | Improve this Doc View Source

    IsSupersetOf<T>(IEnumerable<T>)

    Determines whether a CharArraySet object is a superset of the specified collection.

    Declaration
    public virtual bool IsSupersetOf<T>(IEnumerable<T> other)
    Parameters
    Type Name Description
    IEnumerable<T> other

    The collection to compare to the current CharArraySet object.

    Returns
    Type Description
    System.Boolean

    true if this CharArraySet object is a superset of other; otherwise, false.

    Type Parameters
    Name Description
    T
    | Improve this Doc View Source

    Overlaps(IEnumerable<String>)

    Determines whether the current CharArraySet object and a specified collection share common elements.

    Declaration
    public virtual bool Overlaps(IEnumerable<string> other)
    Parameters
    Type Name Description
    IEnumerable<System.String> other

    The collection to compare to the current CharArraySet object.

    Returns
    Type Description
    System.Boolean

    true if the CharArraySet object and other share at least one common element; otherwise, false.

    | Improve this Doc View Source

    Overlaps<T>(IEnumerable<T>)

    Determines whether the current CharArraySet object and a specified collection share common elements.

    Declaration
    public virtual bool Overlaps<T>(IEnumerable<T> other)
    Parameters
    Type Name Description
    IEnumerable<T> other

    The collection to compare to the current CharArraySet object.

    Returns
    Type Description
    System.Boolean

    true if this CharArraySet object and other share at least one common element; otherwise, false.

    Type Parameters
    Name Description
    T
    | Improve this Doc View Source

    Remove(String)

    Declaration
    public virtual bool Remove(string item)
    Parameters
    Type Name Description
    System.String item
    Returns
    Type Description
    System.Boolean
    | Improve this Doc View Source

    SetEquals(IEnumerable<String>)

    Determines whether the current set and the specified collection contain the same elements.

    Declaration
    public virtual bool SetEquals(IEnumerable<string> other)
    Parameters
    Type Name Description
    IEnumerable<System.String> other

    The collection to compare to the current set.

    Returns
    Type Description
    System.Boolean

    true if the current set is equal to other; otherwise, false.

    | Improve this Doc View Source

    SymmetricExceptWith(IEnumerable<String>)

    Declaration
    public void SymmetricExceptWith(IEnumerable<string> other)
    Parameters
    Type Name Description
    IEnumerable<System.String> other
    | Improve this Doc View Source

    ToString()

    Returns a string that represents the current object. (Inherited from .)

    Declaration
    public override string ToString()
    Returns
    Type Description
    System.String
    | Improve this Doc View Source

    UnionWith(IEnumerable<ICharSequence>)

    Modifies the current CharArraySet to contain all elements that are present in itself, the specified collection, or both.

    Declaration
    public virtual bool UnionWith(IEnumerable<ICharSequence> other)
    Parameters
    Type Name Description
    IEnumerable<ICharSequence> other

    The collection whose elements should be merged into the CharArraySet.

    Returns
    Type Description
    System.Boolean

    true if this CharArraySet changed as a result of the call

    | Improve this Doc View Source

    UnionWith(IEnumerable<Char[]>)

    Modifies the current CharArraySet to contain all elements that are present in itself, the specified collection, or both.

    Declaration
    public virtual bool UnionWith(IEnumerable<char[]> other)
    Parameters
    Type Name Description
    IEnumerable<System.Char[]> other

    The collection whose elements should be merged into the CharArraySet.

    Returns
    Type Description
    System.Boolean

    true if this CharArraySet changed as a result of the call

    | Improve this Doc View Source

    UnionWith(IEnumerable<String>)

    Modifies the current CharArraySet to contain all elements that are present in itself, the specified collection, or both.

    Declaration
    public virtual void UnionWith(IEnumerable<string> other)
    Parameters
    Type Name Description
    IEnumerable<System.String> other

    The collection whose elements should be merged into the CharArraySet.

    | Improve this Doc View Source

    UnionWith<T>(IEnumerable<T>)

    Modifies the current CharArraySet to contain all elements that are present in itself, the specified collection, or both.

    Declaration
    public virtual bool UnionWith<T>(IEnumerable<T> other)
    Parameters
    Type Name Description
    IEnumerable<T> other

    The collection whose elements should be merged into the CharArraySet.

    Returns
    Type Description
    System.Boolean

    true if this CharArraySet changed as a result of the call

    Type Parameters
    Name Description
    T
    | Improve this Doc View Source

    UnmodifiableSet(CharArraySet)

    Returns an unmodifiable CharArraySet. This allows to provide unmodifiable views of internal sets for "read-only" use.

    Declaration
    public static CharArraySet UnmodifiableSet(CharArraySet set)
    Parameters
    Type Name Description
    CharArraySet set

    a set for which the unmodifiable set is returned.

    Returns
    Type Description
    CharArraySet

    an new unmodifiable CharArraySet.

    Extension Methods

    CharArraySetExtensions.Add(CharArraySet, Boolean)
    CharArraySetExtensions.Add(CharArraySet, Byte)
    CharArraySetExtensions.Add(CharArraySet, Char)
    CharArraySetExtensions.Add(CharArraySet, Int32)
    CharArraySetExtensions.Add(CharArraySet, Int64)
    CharArraySetExtensions.Add(CharArraySet, SByte)
    CharArraySetExtensions.Add(CharArraySet, Int16)
    CharArraySetExtensions.Add(CharArraySet, UInt32)
    CharArraySetExtensions.Add(CharArraySet, UInt64)
    CharArraySetExtensions.Add(CharArraySet, UInt16)
    CharArraySetExtensions.Contains(CharArraySet, Boolean)
    CharArraySetExtensions.Contains(CharArraySet, Byte)
    CharArraySetExtensions.Contains(CharArraySet, Char)
    CharArraySetExtensions.Contains(CharArraySet, Int32)
    CharArraySetExtensions.Contains(CharArraySet, Int64)
    CharArraySetExtensions.Contains(CharArraySet, SByte)
    CharArraySetExtensions.Contains(CharArraySet, Int16)
    CharArraySetExtensions.Contains(CharArraySet, UInt32)
    CharArraySetExtensions.Contains(CharArraySet, UInt64)
    CharArraySetExtensions.Contains(CharArraySet, UInt16)
    CharArraySetExtensions.UnionWith(CharArraySet, IEnumerable<Byte>)
    CharArraySetExtensions.UnionWith(CharArraySet, IEnumerable<Char>)
    CharArraySetExtensions.UnionWith(CharArraySet, IEnumerable<Int32>)
    CharArraySetExtensions.UnionWith(CharArraySet, IEnumerable<Int64>)
    CharArraySetExtensions.UnionWith(CharArraySet, IEnumerable<SByte>)
    CharArraySetExtensions.UnionWith(CharArraySet, IEnumerable<Int16>)
    CharArraySetExtensions.UnionWith(CharArraySet, IEnumerable<UInt32>)
    CharArraySetExtensions.UnionWith(CharArraySet, IEnumerable<UInt64>)
    CharArraySetExtensions.UnionWith(CharArraySet, IEnumerable<UInt16>)
    • Improve this Doc
    • View Source
    Back to top Copyright © 2020 Licensed to the Apache Software Foundation (ASF)