Class Heap<TData>
An implementation of the Heap data structure.
Inheritance
Inherited Members
Namespace: Telerik.Windows.Diagrams.Core
Assembly: Telerik.WinControls.RadDiagram.dll
Syntax
public class Heap<TData> : ICollection<TData>, IEnumerable<TData>, IEnumerable
Type Parameters
|
TData
The type of item stored in the Heap<TData>. |
Remarks
Constructors
Heap(OrderType)
Initializes a new instance of the Heap<TData> class.
Declaration
public Heap(OrderType type)
Parameters
|
OrderType
type
The type. |
Heap(OrderType, IComparer<TData>)
Initializes a new instance of the Heap<TData> class.
Declaration
public Heap(OrderType type, IComparer<TData> comparer)
Parameters
|
OrderType
type
The type. |
|
System.Collections.Generic.IComparer<TData>
comparer
The comparer. |
Heap(OrderType, Comparison<TData>)
Initializes a new instance of the Heap<TData> class.
Declaration
public Heap(OrderType type, Comparison<TData> comparer)
Parameters
|
OrderType
type
The type. |
|
System.Comparison<TData>
comparer
The comparer. |
Heap(OrderType, Int32)
Initializes a new instance of the Heap<TData> class.
Declaration
public Heap(OrderType type, int capacity)
Parameters
|
OrderType
type
The type. |
|
System.Int32
capacity
The capacity. |
Heap(OrderType, Int32, IComparer<TData>)
Initializes a new instance of the Heap<TData> class.
Declaration
public Heap(OrderType type, int capacity, IComparer<TData> comparer)
Parameters
|
OrderType
type
The type. |
|
System.Int32
capacity
The capacity. |
|
System.Collections.Generic.IComparer<TData>
comparer
The comparer. |
Heap(OrderType, Int32, Comparison<TData>)
Initializes a new instance of the Heap<TData> class.
Declaration
public Heap(OrderType type, int capacity, Comparison<TData> comparer)
Parameters
|
OrderType
type
The type. |
|
System.Int32
capacity
The capacity. |
|
System.Comparison<TData>
comparer
The comparer. |
Properties
Count
Gets the number of items in this heap structure.
Declaration
public int Count { get; }
Property Value
|
System.Int32
|
Implements
IsEmpty
Gets a value indicating whether this instance is empty.
Declaration
public bool IsEmpty { get; }
Property Value
|
System.Boolean
|
IsReadOnly
Returns false; the heap is never read-only.
Declaration
public bool IsReadOnly { get; }
Property Value
|
System.Boolean
|
Implements
Root
Gets the root of the heap.
Declaration
public TData Root { get; }
Property Value
|
TData
|
Type
Gets the type of heap.
Declaration
public OrderType Type { get; }
Property Value
|
OrderType
The type of heap. |
Methods
Add(TData)
Adds the given item to the heap.
Declaration
public void Add(TData item)
Parameters
|
TData
item
The item to be added. |
Implements
AddItem(TData)
Adds the given item to the heap.
Declaration
protected virtual void AddItem(TData item)
Parameters
|
TData
item
The item. |
Clear()
Clears this heap of all data.
Declaration
public void Clear()
Implements
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
|
TData
item
The item to test. |
Returns
|
System.Boolean
|
Implements
CopyTo(TData[], Int32)
Copies the heap data to an array.
Declaration
public void CopyTo(TData[] array, int arrayIndex)
Parameters
|
TData[]
array
The array. |
|
System.Int32
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
|
System.Collections.Generic.IEnumerator<TData>
A System.Collections.Generic.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 System.String that represents this instance.
Declaration
public override string ToString()
Returns
|
System.String
A System.String that represents this instance. |
Overrides
Explicit Interface Implementations
ICollection<TData>.Remove(TData)
Removes the specified item from the heap.
Declaration
bool ICollection<TData>.Remove(TData item)
Parameters
|
TData
item
The item. |
Returns
|
System.Boolean
The remove. |
Implements
IEnumerable.GetEnumerator()
Returns an enumerator that iterates through a collection.
Declaration
IEnumerator IEnumerable.GetEnumerator()
Returns
|
System.Collections.IEnumerator
An System.Collections.IEnumerator object that can be used to iterate through the collection. |