Comparable

Description

static class Tinman.Core.Collections.Comparable
<T : IComparable<T>>

Helper class for dealing with arrays and generic lists.

Public / Methods

BinarySearch


[Pure]
public static method BinarySearch → (4)

value in : T

The value to search.

array in : T [ ]

[not-null]
The array (must be sorted in ascending order).

offset opt : int32 = 0

[>=0]
Index of first array element to search.

count opt : int32 = -1

[>=-1]
Length of array range to search. If -1, all remaining elements will be used.

returns → int32

Index of the array element that equals value in. If the value has not been found in the array, -idx-1 is returned, where idx is the insertion index of value in.

Runs a binary search for value in in the given array.

Compare


[Pure]
public static method Compare → (2)

in : T

First value.

in : T

Second value.

returns → int32

if in is less than in.
[=0] if in is equal to in.
[>0] if in is greater than in.

Compares the given values.

See also

CompareDelegate

Equals


[Pure]
public static method Equals → (2)

in : T

First value.

in : T

Second value.

returns → bool

true if Compare would return 0, false if not.

Compares the given values.

Sort


public static method Sort → (3)

array in : T [ ]

[not-null]
The array that holds the range to sort.

offset opt : int32 = 0

[>=0]
Offset into array in to first element in range.

count opt : int32 = -1

[>=-1]
Total number of elements in range. If -1, all remaining elements will be used.

returns → T [ ]

The sorted input array in.

Sorts the given array range.

Sort4


[Pure]
public static method Sort4 → (4)

d0 in : T

First value to sort.

d1 in : T

Second value to sort.

d2 in : T

Third value to sort.

d3 in : T

Fourth value to sort.

returns → Vec4I

The sort order:
Vec4I.X: sort order index of d0 in
Vec4I.Y: sort order index of d1 in
Vec4I.Z: sort order index of d2 in
Vec4I.W: sort order index of d3 in

Sorts the given values.

SortIndex


public static method SortIndex → (4)

array in : T [ ]

[not-null]
The array that holds the elements to compare. This array will not be modified.

indices in : int32 [ ]

[not-null]
The array indices to be sorted (the values in this array are used to access array in).

offset opt : int32 = 0

[>=0]
Offset into array in to first element in range.

count opt : int32 = -1

[>=-1]
Total number of elements in range. If -1, all remaining elements will be used.

returns → T [ ]

The sorted input array in.

Sorts the given array range.

SortList


public static method SortList → (3)

list in : IVector<T>

[not-null]
The list that holds the range to sort.

offset opt : int32 = 0

[>=0]
Offset into list in to first element in range.

count opt : int32 = -1

[>=-1]
Total number of elements in range. If -1, all remaining elements will be used.

returns → IVector<T>

The sorted input list in.

Sorts the given list range.