MW UNITY NAMESPACE








































public class <T> where T : IHeapItem

THeap


The implementation of a Minimum or Maximum Heap.


CONSTRUCTOR (SortFunc<T> HeapOrder)

Summary:

Generates a new Heap.

Remarks:

Initialised with an initial size of 32.

Params:

HeapOrder:

        The ordering in which to sort T in a heap.


CONSTRUCTOR (int InitialSize, SortFunc<T> HeapOrder)

Summary:

Generates a new Heap, initialised with MaxSize.

Params:

InitialSize:

        The size of the heap.

HeapOrder:

        The ordering in which to sort T in a heap.



public void

Add (T Item)

Summary:

Adds an item to this Heap.

Params:

Item:

        The item to add.



public R

RemoveFirst ()

Summary:

Remove the Element at the root of this Heap.

Returns:

The element that was removed.



public void

UpdateItem (T Item)

Summary:

Updates Item's position in the Heap.

Params:

Item:

        The item to update.



public void

UpdateItemUp (T Item)

Summary:

Sorts this Item upwards.

Params:

Item:

        The item to update.



public void

UpdateItemDown (T Item)

Summary:

Sorts this Item downwards.

Params:

Item:

        The item to update.



public bool

Contains (T Item)

Summary:

Whether or not this Heap contains Item.

Params:

Item:

        The Item to check.

Returns:

True if Item exists in this Heap.



public void

Flush ()

Summary:

Clears this Heap.



public T[]

TArray ()

Summary:

The Heap as a T[].

Returns:

T[] in the order of this THeap.