Show / Hide Table of Contents

    Class TimSorter

    Sorter implementation based on the TimSort algorithm.

    This implementation is especially good at sorting partially-sorted arrays and sorts small arrays with binary sort.

    NOTE:There are a few differences with the original implementation:

    • The extra amount of memory to perform merges is configurable. This allows small merges to be very fast while large merges will be performed in-place (slightly slower). You can make sure that the fast merge routine will always be used by having maxTempSlots equal to half of the length of the slice of data to sort.
    • Only the fast merge routine can gallop (the one that doesn't run in-place) and it only gallops on the longest slice.

    This is a Lucene.NET INTERNAL API, use at your own risk
    Inheritance
    System.Object
    Sorter
    TimSorter
    Inherited Members
    Sorter.Compare(Int32, Int32)
    Sorter.Swap(Int32, Int32)
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.ToString()
    Namespace: Lucene.Net.Util
    Assembly: Lucene.Net.dll
    Syntax
    public abstract class TimSorter : Sorter

    Constructors

    | Improve this Doc View Source

    TimSorter(Int32)

    Create a new TimSorter.

    Declaration
    protected TimSorter(int maxTempSlots)
    Parameters
    Type Name Description
    System.Int32 maxTempSlots

    The maximum amount of extra memory to run merges

    Methods

    | Improve this Doc View Source

    CompareSaved(Int32, Int32)

    Compare element i from the temporary storage with element j from the slice to sort, similarly to Compare(Int32, Int32).

    Declaration
    protected abstract int CompareSaved(int i, int j)
    Parameters
    Type Name Description
    System.Int32 i
    System.Int32 j
    Returns
    Type Description
    System.Int32
    | Improve this Doc View Source

    Copy(Int32, Int32)

    Copy data from slot src to slot dest>.

    Declaration
    protected abstract void Copy(int src, int dest)
    Parameters
    Type Name Description
    System.Int32 src
    System.Int32 dest
    | Improve this Doc View Source

    Restore(Int32, Int32)

    Restore element j from the temporary storage into slot i.

    Declaration
    protected abstract void Restore(int i, int j)
    Parameters
    Type Name Description
    System.Int32 i
    System.Int32 j
    | Improve this Doc View Source

    Save(Int32, Int32)

    Save all elements between slots i and i+len into the temporary storage.

    Declaration
    protected abstract void Save(int i, int len)
    Parameters
    Type Name Description
    System.Int32 i
    System.Int32 len
    | Improve this Doc View Source

    Sort(Int32, Int32)

    Sort the slice which starts at from (inclusive) and ends at to (exclusive).

    Declaration
    public override void Sort(int from, int to)
    Parameters
    Type Name Description
    System.Int32 from
    System.Int32 to
    Overrides
    Sorter.Sort(Int32, Int32)

    Extension Methods

    Number.IsNumber(Object)
    • Improve this Doc
    • View Source
    Back to top Copyright © 2019 Licensed to the Apache Software Foundation (ASF)