Struct FixedMinHeap<T>
A data structure to store a fixed-size list of elements and their priorities where the root is always the minimum priority value
Namespace: Unity.Semantic.Traits.Queries
Syntax
public struct FixedMinHeap<T> : IDisposable where T : struct
Type Parameters
| Name | Description |
|---|---|
| T | Type of data stored in the heap |
Constructors
FixedMinHeap(Int32, Allocator)
Constructs a new FixedMinHeap using the specified type of memory allocation.
Declaration
public FixedMinHeap(int capacity, Allocator allocator)
Parameters
| Type | Name | Description |
|---|---|---|
| Int32 | capacity | The maximum capacity of the heap. |
| Allocator | allocator | A member of the Unity.Collections.Allocator enumeration. |
Properties
Capacity
Maximum capacity
Declaration
public int Capacity { get; }
Property Value
| Type | Description |
|---|---|
| Int32 |
Length
Number of elements in the heap
Declaration
public int Length { get; }
Property Value
| Type | Description |
|---|---|
| Int32 |
Max
Get the largest element
Declaration
public T Max { get; }
Property Value
| Type | Description |
|---|---|
| T |
Min
Get the smallest element
Declaration
public T Min { get; }
Property Value
| Type | Description |
|---|---|
| T |
Methods
Dispose()
Disposes of this container and deallocates its memory immediately.
Declaration
public void Dispose()
RemoveMin()
Remove the smallest element
Declaration
public void RemoveMin()
TryInsert(Single, T)
Try to insert a value in the heap
Declaration
public bool TryInsert(float priority, T data)
Parameters
| Type | Name | Description |
|---|---|---|
| Single | priority | Priority value to compare heap elements |
| T | data | Data associated to a help element |
Returns
| Type | Description |
|---|---|
| Boolean | Whether or not the element was inserted in the heap |