Class BinaryHeap
- Namespace
- Sportradar.LiveData.Sdk.Services.PriorityQueue
- Assembly
- Sportradar.LiveData.Sdk.dll
Collection implemented with the properties of a binary heap.
public class BinaryHeap : ICollection, IEnumerable, ICloneable
- Inheritance
-
BinaryHeap
- Implements
- Derived
- Inherited Members
Constructors
BinaryHeap()
Initialize the heap.
public BinaryHeap()
BinaryHeap(BinaryHeap)
Initialize the heap with another heap.
public BinaryHeap(BinaryHeap heap)
Parameters
heapBinaryHeapThe heap on which to perform a shallow-copy.
BinaryHeap(IComparer)
Initialize the heap.
public BinaryHeap(IComparer comparer)
Parameters
comparerIComparer
BinaryHeap(IComparer, int)
Initialize the heap.
public BinaryHeap(IComparer comparer, int capacity)
Parameters
BinaryHeap(int)
Initialize the heap.
public BinaryHeap(int capacity)
Parameters
capacityintThe initial size of the heap.
Properties
Count
Gets the number of objects stored in the heap.
public virtual int Count { get; }
Property Value
IsSynchronized
Gets a value indicating whether this heap is synchronized.
public virtual bool IsSynchronized { get; }
Property Value
SyncRoot
Gets an object which can be locked in order to synchronize this class.
public object SyncRoot { get; }
Property Value
Methods
BottomElement()
Checks the entry at the bottom of the heap.
public virtual object BottomElement()
Returns
- object
The entry.
Clear()
Empties the heap.
public virtual void Clear()
Clone()
Performs a shallow-copy of the heap.
public virtual BinaryHeap Clone()
Returns
- BinaryHeap
A shallow-copy of the heap.
Contains(object)
Determines whether an object is in the heap.
public virtual bool Contains(object value)
Parameters
valueobjectThe object for which we want to search.
Returns
- bool
Whether the object is in the heap.
CopyTo(Array, int)
Copies the entire heap to a compatible one-dimensional array, starting at the given index.
public virtual void CopyTo(Array array, int index)
Parameters
GetEnumerator()
Gets an enumerator for the heap.
public virtual IEnumerator GetEnumerator()
Returns
- IEnumerator
An enumerator for all elements of the heap.
Insert(object, object)
Adds an item to the heap.
public virtual void Insert(object key, object value)
Parameters
Remove()
Removes the entry at the top of the heap.
public virtual object Remove()
Returns
- object
The removed entry.
RemoveLast()
Remove the worst element.
public object RemoveLast()
Returns
Synchronize(BinaryHeap)
Ensures that heap is wrapped in a synchronous wrapper.
public static BinaryHeap Synchronize(BinaryHeap heap)
Parameters
heapBinaryHeapThe heap to be wrapped.
Returns
- BinaryHeap
A synchronized wrapper for the heap.
TopElement()
Checks the entry at the top of the heap.
public virtual object TopElement()
Returns
- object
The entry.