Show / Hide Table of Contents

Class HeapArray<T, TCompare>

A heap with static priorities implemented as a array.

Inheritance
System.Object
HeapArray<T, TCompare>
Implements
IHeap<T, TCompare>
DataStructure.IComparing<T, TCompare>
IHeap<T>
IDataStructure<T>
ISteppable<T>
System.Collections.Generic.IEnumerable<T>
DataStructure.ICountable
DataStructure.IClearable
ICloneable<HeapArray<T, TCompare>>
Namespace: Towel.DataStructures
Assembly: Towel.dll
Syntax
public class HeapArray<T, TCompare> : object, IHeap<T, TCompare>, DataStructure.IComparing<T, TCompare>, IHeap<T>, IDataStructure<T>, ISteppable<T>, System.Collections.Generic.IEnumerable<T>, DataStructure.ICountable, DataStructure.IClearable, ICloneable<HeapArray<T, TCompare>> where TCompare : struct, IFunc<T, T, CompareResult>
Type Parameters
Name Description
T

The type of values stored in this data structure.

TCompare

The type that is comparing T values.

Constructors

| Improve this Doc View Source

HeapArray(TCompare, Nullable<Int32>)

Declaration
public HeapArray(TCompare compare = default(TCompare), int? minimumCapacity = null)
Parameters
Type Name Description
TCompare compare
System.Nullable<System.Int32> minimumCapacity

Properties

| Improve this Doc View Source

Compare

Gets the value of the comparer that is comparing T values.

Declaration
public TCompare Compare { get; }
Property Value
Type Description
TCompare
| Improve this Doc View Source

Count

Gets the current count of the data structure.

Declaration
public int Count { get; }
Property Value
Type Description
System.Int32
| Improve this Doc View Source

CurrentCapacity

The maximum items the queue can hold.
Runtime: O(1)

Declaration
public int CurrentCapacity { get; }
Property Value
Type Description
System.Int32
| Improve this Doc View Source

MinimumCapacity

The minumum capacity of this queue to limit low-level resizing.
Runtime: O(1)

Declaration
public int? MinimumCapacity { get; set; }
Property Value
Type Description
System.Nullable<System.Int32>

Methods

| Improve this Doc View Source

Clear()

Returns the data structure to an empty state.

Declaration
public void Clear()
| Improve this Doc View Source

Clone()

Clones a T.

Declaration
public HeapArray<T, TCompare> Clone()
Returns
Type Description
HeapArray<T, TCompare>

A clone of the T.

| Improve this Doc View Source

Dequeue()

Removes and returns the highest priority item.

Declaration
public T Dequeue()
Returns
Type Description
T

The highest priority item from the heap.

| Improve this Doc View Source

Enqueue(T)

Enqueues an item into the heap.

Declaration
public void Enqueue(T value)
Parameters
Type Name Description
T value

The value to queue in the heap.

| Improve this Doc View Source

GetEnumerator()

Declaration
public System.Collections.Generic.IEnumerator<T> GetEnumerator()
Returns
Type Description
System.Collections.Generic.IEnumerator<T>
| Improve this Doc View Source

Peek()

Returns the highest priority item.

Declaration
public T Peek()
Returns
Type Description
T

The highest priority item in the heap.

| Improve this Doc View Source

Requeue(T)

Requeues an item after a change has occured.
Runtime: O(n)

Declaration
public void Requeue(T item)
Parameters
Type Name Description
T item

The item to requeue.

| Improve this Doc View Source

StepperBreak<TStep>(TStep)

Traverses values and invokes a function on every T value.

Declaration
public StepStatus StepperBreak<TStep>(TStep step = default(TStep))
    where TStep : struct, IFunc<T, StepStatus>
Parameters
Type Name Description
TStep step

The function to invoke on every T value.

Returns
Type Description
StepStatus

The status of the traversal.

Type Parameters
Name Description
TStep

The type of function to invoke on every T value.

| Improve this Doc View Source

ToArray()

Constructs an array with the values of this data structure.

Declaration
public T[] ToArray()
Returns
Type Description
T[]

An array with the values of this data structure.

Implements

IHeap<T, TCompare>
DataStructure.IComparing<T, TCompare>
IHeap<T>
IDataStructure<T>
ISteppable<T>
System.Collections.Generic.IEnumerable<>
DataStructure.ICountable
DataStructure.IClearable
ICloneable<T>
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX