Fork me on GitHub
  • API

    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.

    Note

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

    Inheritance
    object
    Sorter
    TimSorter
    Inherited Members
    Sorter.Compare(int, int)
    Sorter.Swap(int, int)
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Lucene.Net.Util
    Assembly: Lucene.Net.dll
    Syntax
    public abstract class TimSorter : Sorter

    Constructors

    TimSorter(int)

    Create a new TimSorter.

    Declaration
    protected TimSorter(int maxTempSlots)
    Parameters
    Type Name Description
    int maxTempSlots

    The maximum amount of extra memory to run merges

    Methods

    CompareSaved(int, int)

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

    Declaration
    protected abstract int CompareSaved(int i, int j)
    Parameters
    Type Name Description
    int i
    int j
    Returns
    Type Description
    int

    Copy(int, int)

    Copy data from slot src to slot dest>.

    Declaration
    protected abstract void Copy(int src, int dest)
    Parameters
    Type Name Description
    int src
    int dest

    Restore(int, int)

    Restore element j from the temporary storage into slot i.

    Declaration
    protected abstract void Restore(int i, int j)
    Parameters
    Type Name Description
    int i
    int j

    Save(int, int)

    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
    int i
    int len

    Sort(int, int)

    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
    int from
    int to
    Overrides
    Sorter.Sort(int, int)
    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.