Class SortedArrayList<T>
- Namespace
- RandomizerCore.Collections
- Assembly
- RandomizerCore.dll
A sorted list which maintains its sort through binary search during list operations.
public class SortedArrayList<T> : IReadOnlyList<T>, IReadOnlyCollection<T>, ICollection<T>, IEnumerable<T>, IEnumerable
Type Parameters
T
- Inheritance
-
SortedArrayList<T>
- Implements
-
ICollection<T>IEnumerable<T>
- Inherited Members
- Extension Methods
Constructors
SortedArrayList()
public SortedArrayList()
SortedArrayList(IComparer<T>, IEqualityComparer<T>)
public SortedArrayList(IComparer<T> comparer, IEqualityComparer<T> eqComparer)
Parameters
comparer
IComparer<T>eqComparer
IEqualityComparer<T>
SortedArrayList(IEnumerable<T>)
public SortedArrayList(IEnumerable<T> input)
Parameters
input
IEnumerable<T>
SortedArrayList(IEnumerable<T>, IComparer<T>, IEqualityComparer<T>)
public SortedArrayList(IEnumerable<T> input, IComparer<T> comparer, IEqualityComparer<T> eqComparer)
Parameters
input
IEnumerable<T>comparer
IComparer<T>eqComparer
IEqualityComparer<T>
SortedArrayList(int)
public SortedArrayList(int capacity)
Parameters
capacity
int
SortedArrayList(int, IComparer<T>, IEqualityComparer<T>)
public SortedArrayList(int capacity, IComparer<T> comparer, IEqualityComparer<T> eqComparer)
Parameters
capacity
intcomparer
IComparer<T>eqComparer
IEqualityComparer<T>
Properties
Count
public int Count { get; }
Property Value
IsReadOnly
public bool IsReadOnly { get; }
Property Value
this[int]
public T this[int index] { get; set; }
Parameters
index
int
Property Value
- T
Methods
Add(T)
Inserts the item into the sorted list using binary search. Item will appear after all elements which compare equal.
public void Add(T t)
Parameters
t
T
Clear()
public void Clear()
Contains(T)
Uses binary search to find the range in which the element could be found, and then tests each element in the range for equality.
public bool Contains(T item)
Parameters
item
T
Returns
CopyTo(T[], int)
public void CopyTo(T[] array, int arrayIndex)
Parameters
array
T[]arrayIndex
int
CountGE(T)
Counts the number of elements greater than or equal to the input.
public int CountGE(T t)
Parameters
t
T
Returns
CountGT(T)
Counts the number of elements greater than the input.
public int CountGT(T t)
Parameters
t
T
Returns
CountLE(T)
Counts the number of elements less than or equal to the input.
public int CountLE(T t)
Parameters
t
T
Returns
CountLT(T)
Counts the number of elements less than the input.
public int CountLT(T t)
Parameters
t
T
Returns
ExtractMin()
public T ExtractMin()
Returns
- T
FindExclusiveUpperBound(T)
Returns the least index such that its entry is strictly greater than the input, or Count.
public int FindExclusiveUpperBound(T t)
Parameters
t
T
Returns
FindExclusiveUpperBound(T, int, int)
Returns the least index in the range such that its entry is strictly greater than the input, or ub.
public int FindExclusiveUpperBound(T t, int lb, int ub)
Parameters
Returns
FindInclusiveLowerBound(T)
Returns the least index such that its entry is greater than or equal to the input, or 0.
public int FindInclusiveLowerBound(T t)
Parameters
t
T
Returns
FindInclusiveLowerBound(T, int, int)
Returns the least index in the range such that its entry is greater than or equal to the input, or lb.
public int FindInclusiveLowerBound(T t, int lb, int ub)
Parameters
Returns
Remove(T)
Uses binary search to find the range in which the element could be found, and then removes the first element in the range which gives equality, if it exists.
public bool Remove(T item)
Parameters
item
T
Returns
RemoveAt(int)
public void RemoveAt(int index)
Parameters
index
int
TryExtractMin(out T)
public bool TryExtractMin(out T t)
Parameters
t
T