Class StableComparer<T>
Stable comparer for stable sorting algorithm.
Inheritance
System.Object
StableComparer<T>
Namespace: ISynergy.Framework.Mathematics.Comparers
Assembly: ISynergy.Framework.Mathematics.dll
Syntax
public class StableComparer<T> : IComparer<KeyValuePair<int, T>>
Type Parameters
Name | Description |
---|---|
T | The type of objects to compare. |
Remarks
This class helps sort the elements of an array without swapping
elements which are already in order. This comprises a stable
sorting algorithm.
Constructors
View SourceStableComparer(Comparison<T>)
Constructs a new instance of the StableComparer<T> class.
Declaration
public StableComparer(Comparison<T> comparison)
Parameters
Type | Name | Description |
---|---|---|
Comparison<T> | comparison | The comparison function. |
Methods
View SourceCompare(KeyValuePair<Int32, T>, KeyValuePair<Int32, T>)
Compares two objects and returns a value indicating whether one is less than, equal to, or greater than the other.
Declaration
public int Compare(KeyValuePair<int, T> x, KeyValuePair<int, T> y)
Parameters
Type | Name | Description |
---|---|---|
KeyValuePair<System.Int32, T> | x | The first object to compare. |
KeyValuePair<System.Int32, T> | y | The second object to compare. |
Returns
Type | Description |
---|---|
System.Int32 | A signed integer that indicates the relative values of x and y. |
Extension Methods
CollectionExtensions.FromHierarchy<TSource>(TSource, Func<TSource, TSource>, Func<TSource, Boolean>)