Generated by DocFX

Class BinaryTree<TNode>

Base class for binary trees. This class does not implement a binary search tree, but can used to implement one. For binary search trees, please refer to RedBlackTree<T>, KDTree and VPTree.

Inheritance
System.Object
BinaryTree<TNode>
RedBlackTree<T>
Namespace: ISynergy.Framework.Core.Collections
Assembly: ISynergy.Framework.Core.dll
Syntax
public class BinaryTree<TNode> : IEnumerable<TNode> where TNode : BinaryNode<TNode>
Type Parameters
Name Description
TNode

The class type for the nodes of the tree.

Examples

The BinaryTree<TNode> class is a base class for other tree classes such as RedBlackTree<T>, KDTree and VPTree. For examples on how to use those classes, please see their respective documentation pages.

If you would like to implement your own binary tree that inherits from this class, then you can do so as shown in the following example. First, make sure your custom node class inherits from BinaryNode<TNode> and passes itself as the generic argument of BinaryNode<TNode>:

Now, once the tree node has been implemented, we can create a new BinaryTree<TNode> and explore the tree in different ways as shown below:

Properties

View Source

Root

Gets the root node of this tree.

Declaration
public TNode Root { get; set; }
Property Value
Type Description
TNode

Methods

View Source

GetEnumerator()

Returns an enumerator that iterates through the tree.

Declaration
public virtual IEnumerator<TNode> GetEnumerator()
Returns
Type Description
IEnumerator<TNode>

An IEnumerator object that can be used to iterate through the collection.

View Source

Traverse(BinaryTraversalMethod<TNode>)

Traverse the tree using a tree traversal method. Can be iterated with a foreach loop.

Declaration
public IEnumerable<TNode> Traverse(BinaryTraversalMethod<TNode> method)
Parameters
Type Name Description
BinaryTraversalMethod<TNode> method

The tree traversal method. Common methods are available in the TreeTraversalstatic class.

Returns
Type Description
IEnumerable<TNode>

An object which can be used to traverse the tree using the chosen traversal method.

Extension Methods

Matrix.Replace<T>(T, Object, Object)
Matrix.IsEqual(Object, Object, Decimal, Decimal)
EntityBaseExtensions.HasProperty(Object, String)
ArrayExtensions.Concatenate<T>(T, T[])
CollectionExtensions.FromHierarchy<TSource>(TSource, Func<TSource, TSource>, Func<TSource, Boolean>)
CollectionExtensions.FromHierarchy<TSource>(TSource, Func<TSource, TSource>)
ObjectExtensions.Clone<T>(T)
ObjectExtensions.To<T>(Object)
ObjectExtensions.To(Object, Type)
ObjectExtensions.HasMethod(Object, String)
ObjectExtensions.AddressOf<T>(T)
ReflectionExtensions.GetIdentityValue<T>(T)
ReflectionExtensions.GetIdentityValue<T, TResult>(T)
ReflectionExtensions.GetIdentityProperty<T>(T)
ReflectionExtensions.HasIdentityProperty<T>(T)
ReflectionExtensions.GetPropertyValue<T, TResult>(T, String, TResult)
ReflectionExtensions.GetPropertyInfo<T, TValue>(T, Expression<Func<T, TValue>>)
ReflectionExtensions.GetTitleValue<T>(T)
ReflectionExtensions.HasParentIdentityProperty<T>(T)
ReflectionExtensions.GetParentIdentityProperty<T>(T)
ReflectionExtensions.IsFreeApplication<T>(T)