Base implementation of the ISearchTree<T> interface.
Definition
Namespace:Telerik.Windows.Diagrams.Core
Assembly:Telerik.Windows.Diagrams.Core.dll
Type Parameters:
T
The data type contained in this collection.
Syntax:
public abstract class BinarySearchTreeBase<T> : ISearchTree<T>, ICollection<T>, IEnumerable<T>, IEnumerable
Inheritance: objectBinarySearchTreeBase<T>
Derived Classes:
Implements:
Constructors
Initializes a new instance of the BinarySearchTreeBase<T> class.
protected BinarySearchTreeBase()
Initializes a new instance of the BinarySearchTreeBase<T> class.
protected BinarySearchTreeBase(Comparison<T> comparison)
The comparison.
Initializes a new instance of the BinarySearchTreeBase<T> class.
protected BinarySearchTreeBase(IComparer<T> comparer)
The comparer to use when comparing items.
Exceptions:comparer is a null reference (Nothing in Visual Basic).
Properties
Gets the comparer.
public IComparer<T> Comparer { get; }
The comparer.
Gets a value indicating whether this instance is empty.
public bool IsEmpty { get; }
true if this instance is empty; otherwise, false.
Gets a value indicating whether this instance is read only.
public bool IsReadOnly { get; }
true if this instance is read only; otherwise, false.
Implements:
Gets the maximum.
public virtual T Maximum { get; }
Implements:
Gets the minimum.
public virtual T Minimum { get; }
Implements:
Gets or sets the binary tree.
protected BinaryTree<T> Tree { get; set; }
Methods
Adds the specified item.
public void Add(T item)
The item.
Implements:
Adds the item.
protected abstract void AddItem(T item)
The item.
Clears this instance.
public void Clear()
Implements:
Clears all the objects in this instance.
protected virtual void ClearItems()
Notes to Inheritors: Derived classes can override this method to change the behavior of the Clear() method.
Determines whether the item is in this tree.
public virtual bool Contains(T item)
The item.
Returns:true if [contains] [the specified item]; otherwise, false.
Implements:
Copies to.
public void CopyTo(T[] array, int arrayIndex)
The array.
arrayIndexintIndex of the array.
Implements:
Depth first search traversal.
public void DepthFirstTraversal(IVisitor<T> visitor)
The visitor.
Implements:
Find the maximum node.
Finds the maximum node.
protected static BinaryTree<T> FindMaximumNode(BinaryTree<T> startNode)
The start node.
Returns:BinaryTree<T>
The maximum node below this node.
Find the minimum node.
Finds the minimum node.
protected static BinaryTree<T> FindMinimumNode(BinaryTree<T> startNode)
The start node.
Returns:BinaryTree<T>
The minimum node below this node.
Finds the node containing the specified data key.
protected virtual BinaryTree<T> FindNode(T item)
The item.
Returns:BinaryTree<T>
The node with the specified key if found. If the key is not in the tree, this method returns null.
Finds the node that matches the custom delegate.
protected virtual BinaryTree<T> FindNode<TSearch>(TSearch value, BinarySearchTreeBase<T>.CustomComparison<TSearch> customComparison)
The value.
customComparisonBinarySearchTreeBase<T>.CustomComparison<TSearch>The custom comparison.
Returns:BinaryTree<T>
The item if found, else null.
Returns an enumerator that iterates through the collection.
public IEnumerator<T> GetEnumerator()
IEnumerator<T>
A IEnumerator<T> that can be used to iterate through the collection.
Implements:
Gets the ordered enumerator.
Removes the specified item.
Removes the item from the tree.
protected abstract bool RemoveItem(T item)
The item to remove.
Returns:An indication of whether the item has been removed from the tree.