Show / Hide Table of Contents

Interface ITree<T>

A generic tree data structure.

Inherited Members
IDataStructure<T>.ToArray()
ISteppable<T>.StepperBreak<TStep>(TStep)
DataStructure.ICountable.Count
DataStructure.IRemovable<T>.TryRemove(T)
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 Source

Top

The head of the tree.

Declaration
T Top { get; }
Property Value
Type Description
T

Methods

| Improve this Doc View Source

Children(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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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>>

( Success, ? Exception)

  • Success: true if the value was added to the tree or false if not
  • ? Exception: the exception that occured if the add was not successful

Extension Methods

Steppable.Stepper<T>(ISteppable<T>, Action<T>)
Steppable.Stepper<T, TStep>(ISteppable<T>, TStep)
Steppable.StepperBreak<T>(ISteppable<T>, Func<T, StepStatus>)
DataStructure.Remove<T>(DataStructure.IRemovable<T>, T)
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX