Search Results for

    Show / Hide Table of Contents

    Interface ISearch

    An object able to search for items in direct random access structures, such as lists and arrays, which are monodimensional and implement the interface.

    Namespace: MoreStructures.Lists.Searching
    Assembly: MoreStructures.dll
    Syntax
    public interface ISearch
    Remarks

    In .NET, random access structures usually have an indexer defined, which takes as an index the address of the item in the data structure (usually an integer). Most random access structures (but not all) inherit and define .
    A notable exception is System.String, which has an indexer (System.String.Chars(System.Int32)), but does not implement . For System.String, specific optimizations are done, to ensure random access in O(1) time.

    Methods

    | Improve this Doc View Source

    First<T>(IEnumerable<T>, T, Nullable<IComparer<T>>, Nullable<Int32>, Nullable<Int32>)

    Find the index of the first item in the sub-sequence of items of source from fromIndex to toIndex included, which is equal to item.

    Declaration
    int First<T>(IEnumerable<T> source, T item, IComparer<T>? comparer = null, int? fromIndex = null, int? toIndex = null)
    Parameters
    Type Name Description
    IEnumerable<T> source

    The enumerable where to search for item.

    T item

    The item to search for.

    System.Nullable<IComparer<T>> comparer

    The comparer to be used when performing the search. If not specified, is used.

    System.Nullable<System.Int32> fromIndex

    The first index, marking the begin of the sub-sequence of source where to search. If not specified, 0 is used.

    System.Nullable<System.Int32> toIndex

    The last index, marking the end of the sub-sequence of source where to search. If not specified, is called on source to calculate the count of items, and count - 1 is used. If source is a System.String, however, System.String.Length is used instead.

    Returns
    Type Description
    System.Int32

    The first index of item in source.

    Type Parameters
    Name Description
    T

    The type of items of source. Must be comparable. If it is System.String, random access is done in O(1) via System.String.Chars(System.Int32). Otherwise, random access is done via the generic LINQ method , which is O(n) or O(1) dependending on the concretion.

    | Improve this Doc View Source

    FirstAll<T>(IEnumerable<T>, Nullable<IComparer<T>>, Nullable<Int32>, Nullable<Int32>)

    Find the indexes of the first occurrence of each item in the sub-sequence of items of source from fromIndex to toIndex included.

    Declaration
    IDictionary<T, int> FirstAll<T>(IEnumerable<T> source, IComparer<T>? comparer = null, int? fromIndex = null, int? toIndex = null)
    Parameters
    Type Name Description
    IEnumerable<T> source

    The enumerable.

    System.Nullable<IComparer<T>> comparer

    The comparer to be used when performing the search, to tell apart different items. If not specified, is used.

    System.Nullable<System.Int32> fromIndex

    The first index, marking the begin of the sub-sequence of source where to search. If not specified, 0 is used.

    System.Nullable<System.Int32> toIndex

    The last index, marking the end of the sub-sequence of source where to search. If not specified, is called on source to calculate the count of items, and count - 1 is used. If source is a System.String, however, System.String.Length is used instead.

    Returns
    Type Description
    IDictionary<T, System.Int32>

    A containing the 0-based index first occurrence of each item, indexed by the item itself.

    Type Parameters
    Name Description
    T

    The type of items of source. Must be comparable and non-null, since it is used as key to index first occurrence indexes in the output .
    If it is System.String, random access is done in O(1) via System.String.Chars(System.Int32). Otherwise, random access is done via the generic LINQ method , which is O(n) or O(1) dependending on the concretion.

    | Improve this Doc View Source

    Interval<T>(IEnumerable<T>, T, Nullable<IComparer<T>>, Nullable<Int32>, Nullable<Int32>)

    Find the indexes of the first and last items in the sub-sequence of items of source from fromIndex to toIndex included, which is equal to item.

    Declaration
    (int first, int last) Interval<T>(IEnumerable<T> source, T item, IComparer<T>? comparer = null, int? fromIndex = null, int? toIndex = null)
    Parameters
    Type Name Description
    IEnumerable<T> source

    The enumerable where to search for item.

    T item

    The item to search for.

    System.Nullable<IComparer<T>> comparer

    The comparer to be used when performing the search. If not specified, is used.

    System.Nullable<System.Int32> fromIndex

    The first index, marking the begin of the sub-sequence of source where to search. If not specified, 0 is used.

    System.Nullable<System.Int32> toIndex

    The last index, marking the end of the sub-sequence of source where to search. If not specified, is called on source to calculate the count of items, and count - 1 is used. If source is a System.String, however, System.String.Length is used instead.

    Returns
    Type Description
    System.ValueTuple<System.Int32, System.Int32>

    The first and last index, marking the end of the sub-sequence of source where to search.

    Type Parameters
    Name Description
    T

    The type of items of source. Must be comparable. If it is System.String, random access is done in O(1) via System.String.Chars(System.Int32). Otherwise, random access is done via the generic LINQ method , which is O(n) or O(1) dependending on the concretion.

    | Improve this Doc View Source

    Last<T>(IEnumerable<T>, T, Nullable<IComparer<T>>, Nullable<Int32>, Nullable<Int32>)

    Find the index of the last item in the sub-sequence of items of source from fromIndex to toIndex included, which is equal to item.

    Declaration
    int Last<T>(IEnumerable<T> source, T item, IComparer<T>? comparer = null, int? fromIndex = null, int? toIndex = null)
    Parameters
    Type Name Description
    IEnumerable<T> source

    The enumerable where to search for item.

    T item

    The item to search for.

    System.Nullable<IComparer<T>> comparer

    The comparer to be used when performing the search. If not specified, is used.

    System.Nullable<System.Int32> fromIndex

    The first index, marking the begin of the sub-sequence of source where to search. If not specified, 0 is used.

    System.Nullable<System.Int32> toIndex

    The last index, marking the end of the sub-sequence of source where to search. If not specified, is called on source to calculate the count of items, and count - 1 is used. If source is a System.String, however, System.String.Length is used instead.

    Returns
    Type Description
    System.Int32

    The first and last index, marking the end of the sub-sequence of source where to search.

    Type Parameters
    Name Description
    T

    The type of items of source. Must be comparable. If it is System.String, random access is done in O(1) via System.String.Chars(System.Int32). Otherwise, random access is done via the generic LINQ method , which is O(n) or O(1) dependending on the concretion.

    | Improve this Doc View Source

    Nth<T>(IEnumerable<T>, T, Int32, Nullable<IComparer<T>>, Nullable<Int32>, Nullable<Int32>)

    Find the index of the n-th occurence (0-based) of the item in the sub-sequence of items of source from fromIndex to toIndex included, which is equal to item.

    Declaration
    int Nth<T>(IEnumerable<T> source, T item, int occurrenceRank, IComparer<T>? comparer = null, int? fromIndex = null, int? toIndex = null)
    Parameters
    Type Name Description
    IEnumerable<T> source
    T item
    System.Int32 occurrenceRank
    System.Nullable<IComparer<T>> comparer
    System.Nullable<System.Int32> fromIndex
    System.Nullable<System.Int32> toIndex
    Returns
    Type Description
    System.Int32

    The n-th index, marking the end of the sub-sequence of source where to search.

    Type Parameters
    Name Description
    T

    The type of items of source. Must be comparable. If it is System.String, random access is done in O(1) via System.String.Chars(System.Int32). Otherwise, random access is done via the generic LINQ method , which is O(n) or O(1) dependending on the concretion.

    Extension Methods

    SuffixStructureNodeExtensions.GetAllSuffixesFor<TEdge, TNode>(TNode, TextWithTerminator)
    • Improve this Doc
    • View Source
    In This Article
    Back to top Generated by DocFX