ClassHeap<TData>
An implementation of the Heap data structure.
Definition
Namespace:Telerik.Windows.Diagrams.Core
Assembly:Telerik.Windows.Diagrams.Core.dll
Type Parameters:
TData
The type of item stored in the Heap<TData>.
Syntax:
[SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")]
public class Heap<TData> : ICollection<TData>, IEnumerable<TData>, IEnumerable
Inheritance: objectHeap<TData>
Implements:
Constructors
Heap(OrderType)
Initializes a new instance of the Heap<TData> class.
Heap(OrderType, Comparison<TData>)
Initializes a new instance of the Heap<TData> class.
Declaration
public Heap(OrderType type, Comparison<TData> comparer)
Parameters
type
The type.
comparer
Comparison<TData>
The comparer.
Heap(OrderType, IComparer<TData>)
Initializes a new instance of the Heap<TData> class.
Heap(OrderType, int)
Initializes a new instance of the Heap<TData> class.
Heap(OrderType, int, Comparison<TData>)
Initializes a new instance of the Heap<TData> class.
Declaration
public Heap(OrderType type, int capacity, Comparison<TData> comparer)
Parameters
type
The type.
capacity
The capacity.
comparer
Comparison<TData>
The comparer.
Heap(OrderType, int, IComparer<TData>)
Initializes a new instance of the Heap<TData> class.
Properties
Count
Gets the number of items in this heap structure.
IsEmpty
Gets a value indicating whether this instance is empty.
Declaration
public bool IsEmpty { get; }
Property Value
true if this instance is empty; otherwise, false.
IsReadOnly
Returns false; the heap is never read-only.
Declaration
public bool IsReadOnly { get; }
Property Value
true if this instance is read only; otherwise, false.
Implements
Root
Gets the root of the heap.
Declaration
public TData Root { get; }
Property Value
TData
Methods
Add(TData)
Adds the given item to the heap.
Declaration
public void Add(TData item)
Parameters
item
TData
The item to be added.
Implements
AddItem(TData)
Adds the given item to the heap.
Declaration
protected virtual void AddItem(TData item)
Parameters
item
TData
The item.
ClearItems()
Clears all the objects in this instance.
Declaration
protected virtual void ClearItems()
Remarks
Notes to Inheritors: Derived classes can override this method to change the behavior of the Clear() method.
Contains(TData)
Returns whether the given item is in the heap.
Declaration
public bool Contains(TData item)
Parameters
item
TData
The item to test.
Returns
true if contained in this heap; otherwise, false.
Implements
CopyTo(TData[], int)
Copies the heap data to an array.
Declaration
public void CopyTo(TData[] array, int arrayIndex)
Parameters
array
TData[]
The array.
arrayIndex
Index of the array from which the copying starts.
Implements
GetEnumerator()
Returns an enumerator that iterates through the collection.
Declaration
public IEnumerator<TData> GetEnumerator()
Returns
IEnumerator<TData>
A IEnumerator<T> that can be used to iterate through the collection.
Implements
RemoveRoot()
Removes the root from the heap.
Declaration
public TData RemoveRoot()
Returns
TData
RemoveRootItem()
Removes the root item and arrange the tree in the heap.
Declaration
protected virtual void RemoveRootItem()
ToString()
Returns a string that represents this instance.