Interface ITree<T>
A generic tree data structure.
Inherited Members
Namespace: Towel.DataStructures
Assembly: Towel.dll
Syntax
public interface ITree<T> : IDataStructure<T>, ISteppable<T>, System.Collections.Generic.IEnumerable<T>, DataStructure.ICountable, DataStructure.IRemovable<T>
Type Parameters
Name | Description |
---|---|
T | The generic type stored in this data structure. |
Properties
| Improve this Doc View SourceTop
The head of the tree.
Declaration
T Top { get; }
Property Value
Type | Description |
---|---|
T |
Methods
| Improve this Doc View SourceChildren(T, Action<T>)
Stepper function for the children of a given node.
Declaration
void Children(T parent, Action<T> step)
Parameters
Type | Name | Description |
---|---|---|
T | parent | The node to step through the children of. |
Action<T> | step | The step function. |
IsChildOf(T, T)
Determines if a node is the child of another node.
Declaration
bool IsChildOf(T node, T parent)
Parameters
Type | Name | Description |
---|---|---|
T | node | The child to check the parent of. |
T | parent | The parent to check the child of. |
Returns
Type | Description |
---|---|
System.Boolean | True if the node is a child of the parent; False if not. |
Parent(T)
Gets the parent of a given node.
Declaration
T Parent(T child)
Parameters
Type | Name | Description |
---|---|---|
T | child | The child to get the parent of. |
Returns
Type | Description |
---|---|
T | The parent of the given child. |
TryAdd(T, T)
Adds a node to the tree.
Declaration
(bool Success, Exception? Exception) TryAdd(T addition, T parent)
Parameters
Type | Name | Description |
---|---|---|
T | addition | The node to be added. |
T | parent | The parent of the node to be added. |
Returns
Type | Description |
---|---|
System.ValueTuple<System.Boolean, System.Nullable<Exception>> | (
|