Class OmnitreePointsLinked<T, Axis1>
Omnitree that stores points along 1 dimensions implemented as a linked tree.
Inheritance
Implements
Namespace: Towel.DataStructures
Assembly: Towel.dll
Syntax
public class OmnitreePointsLinked<T, Axis1> : object, IOmnitreePoints<T, Axis1>, IOmnitree<T, Axis1>, IOmnitree<T>, IDataStructure<T>, ISteppable<T>, System.Collections.Generic.IEnumerable<T>, DataStructure.ICountable, DataStructure.IAddable<T>, DataStructure.IClearable
Type Parameters
Name | Description |
---|---|
T | The type of items to store in the omnitree. |
Axis1 | The type 1D axis. |
Constructors
| Improve this Doc View SourceOmnitreePointsLinked(Omnitree.Location<T, Axis1>, Func<Axis1, Axis1, CompareResult>, Omnitree.SubdivisionOverride<T, Axis1, Omnitree.Bounds<Axis1>>)
Constructs a new 1D omnitree that stores points.
Declaration
public OmnitreePointsLinked(Omnitree.Location<T, Axis1> locate, Func<Axis1, Axis1, CompareResult> compare1 = null, Omnitree.SubdivisionOverride<T, Axis1, Omnitree.Bounds<Axis1>> subdivisionOverride1 = null)
Parameters
Type | Name | Description |
---|---|---|
Omnitree.Location<T, Axis1> | locate | The delegate for locating items in 1D space. |
Func<Axis1, Axis1, CompareResult> | compare1 | The delegate for comparing values along the 1D axis. |
Omnitree.SubdivisionOverride<T, Axis1, Omnitree.Bounds<Axis1>> | subdivisionOverride1 | The subdivision overide to be used when splitting the 1 dimension. |
Properties
| Improve this Doc View SourceBranchCount
Counts the current number of branches in the tree. NOT AN O(1) OPERATION. Intended for educational purposes only.
Declaration
public int BranchCount { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Compare1
The comparison function the Omnitree is using along the 1D axis.
Declaration
public Func<Axis1, Axis1, CompareResult> Compare1 { get; }
Property Value
Type | Description |
---|---|
Func<Axis1, Axis1, CompareResult> |
Count
The current number of items in the tree.
Declaration
public int Count { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Dimensions
The number of dimensions in this tree.
Declaration
public int Dimensions { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Item[Axis1]
Steps through all the items at a given coordinate.
Declaration
public Action<Action<T>> this[Axis1 axis1] { get; }
Parameters
Type | Name | Description |
---|---|---|
Axis1 | axis1 | The coordinate along axis 1. |
Property Value
Type | Description |
---|---|
Action<Action<T>> | The stepper for the items at the given coordinate. |
LeafCount
Counts the current number of leaves in the tree. NOT AN O(1) OPERATION. Intended for educational purposes only.
Declaration
public int LeafCount { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Locate
The location function the Omnitree is using.
Declaration
public Omnitree.Location<T, Axis1> Locate { get; }
Property Value
Type | Description |
---|---|
Omnitree.Location<T, Axis1> |
MaxDepth
Finds the current maximum depth of the tree. NOT AN O(1) OPERATION. Intended for educational purposes only.
Declaration
public int MaxDepth { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
NodeCount
Counts the current number of nodes in the tree. NOT AN O(1) OPERATION. Intended for educational purposes only.
Declaration
public int NodeCount { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Methods
| Improve this Doc View SourceAdd(T)
Adds an item to the tree.
Declaration
public void Add(T addition)
Parameters
Type | Name | Description |
---|---|---|
T | addition | The item to be added. |
TryAdd(T)
Tries to add a value.
Declaration
public (bool Success, Exception? Exception) TryAdd(T value)
Parameters
Type | Name | Description |
---|---|---|
T | value | The value to be added. |
Returns
Type | Description |
---|---|
System.ValueTuple<System.Boolean, System.Nullable<Exception>> | True if successful or false if not. |