Class BinarySearchTreeBase<T>
Base implementation of the ISearchTree<T> interface.
Inheritance
Namespace: Telerik.Windows.Diagrams.Core
Assembly: Telerik.Windows.Diagrams.Core.dll
Syntax
public abstract class BinarySearchTreeBase<T> : Object, ISearchTree<T>, ICollection<T>, IEnumerable<T>, IEnumerable
Type Parameters
T
The data type contained in this collection. |
Constructors
BinarySearchTreeBase()
Initializes a new instance of the BinarySearchTreeBase<T> class.
Declaration
protected BinarySearchTreeBase()
BinarySearchTreeBase(IComparer<T>)
Initializes a new instance of the BinarySearchTreeBase<T> class.
Declaration
protected BinarySearchTreeBase(IComparer<T> comparer)
Parameters
System.Collections.Generic.IComparer<T>
comparer
The comparer to use when comparing items. |
Exceptions
System.ArgumentNullException
|
BinarySearchTreeBase(Comparison<T>)
Initializes a new instance of the BinarySearchTreeBase<T> class.
Declaration
protected BinarySearchTreeBase(Comparison<T> comparison)
Parameters
System.Comparison<T>
comparison
The comparison. |
Properties
Comparer
Gets the comparer.
Declaration
public IComparer<T> Comparer { get; }
Property Value
System.Collections.Generic.IComparer<T>
The comparer. |
Count
Gets the count.
Declaration
public int Count { get; }
Property Value
System.Int32
|
Height
Gets the height.
Declaration
public int Height { get; }
Property Value
System.Int32
|
IsEmpty
Gets a value indicating whether this instance is empty.
Declaration
public bool IsEmpty { get; }
Property Value
System.Boolean
|
IsReadOnly
Gets a value indicating whether this instance is read only.
Declaration
public bool IsReadOnly { get; }
Property Value
System.Boolean
|
Maximum
Gets the maximum.
Declaration
public virtual T Maximum { get; }
Property Value
T
|
Implements
Minimum
Gets the minimum.
Declaration
public virtual T Minimum { get; }
Property Value
T
|
Implements
Tree
Gets or sets the binary tree.
Declaration
protected BinaryTree<T> Tree { get; set; }
Property Value
BinaryTree<T>
|
Methods
Add(T)
Adds the specified item.
Declaration
public void Add(T item)
Parameters
T
item
The item. |
AddItem(T)
Adds the item.
Declaration
protected abstract void AddItem(T item)
Parameters
T
item
The item. |
Clear()
Clears this instance.
Declaration
public void Clear()
ClearItems()
Clears all the objects in this instance.
Declaration
protected virtual void ClearItems()
Remarks
Notes to Inheritors: Derived classes can override this method to change the behavior of the Clear() method.
Contains(T)
Determines whether the item is in this tree.
Declaration
public virtual bool Contains(T item)
Parameters
T
item
The item. |
Returns
System.Boolean
|
CopyTo(T[], Int32)
Copies to.
Declaration
public void CopyTo(T[] array, int arrayIndex)
Parameters
T[]
array
The array. |
System.Int32
arrayIndex
Index of the array. |
DepthFirstTraversal(IVisitor<T>)
Depth first search traversal.
Declaration
public void DepthFirstTraversal(IVisitor<T> visitor)
Parameters
IVisitor<T>
visitor
The visitor. |
Implements
FindMaximumNode()
Find the maximum node.
Declaration
protected BinaryTree<T> FindMaximumNode()
Returns
BinaryTree<T>
The maximum node. |
FindMaximumNode(BinaryTree<T>)
Finds the maximum node.
Declaration
protected static BinaryTree<T> FindMaximumNode(BinaryTree<T> startNode)
Parameters
BinaryTree<T>
startNode
The start node. |
Returns
BinaryTree<T>
The maximum node below this node. |
FindMinimumNode()
Find the minimum node.
Declaration
protected BinaryTree<T> FindMinimumNode()
Returns
BinaryTree<T>
The minimum node. |
FindMinimumNode(BinaryTree<T>)
Finds the minimum node.
Declaration
protected static BinaryTree<T> FindMinimumNode(BinaryTree<T> startNode)
Parameters
BinaryTree<T>
startNode
The start node. |
Returns
BinaryTree<T>
The minimum node below this node. |
FindNode(T)
Finds the node containing the specified data key.
Declaration
protected virtual BinaryTree<T> FindNode(T item)
Parameters
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. |
FindNode<TSearch>(TSearch, BinarySearchTreeBase<T>.CustomComparison<TSearch>)
Finds the node that matches the custom delegate.
Declaration
protected virtual BinaryTree<T> FindNode<TSearch>(TSearch value, BinarySearchTreeBase<T>.CustomComparison<TSearch> customComparison)
Parameters
TSearch
value
The value. |
BinarySearchTreeBase.CustomComparison<TSearch>
customComparison
The custom comparison. |
Returns
BinaryTree<T>
The item if found, else null. |
Type Parameters
TSearch
The type of the search. |
GetEnumerator()
Returns an enumerator that iterates through the collection.
Declaration
public IEnumerator<T> GetEnumerator()
Returns
System.Collections.Generic.IEnumerator<T>
A System.Collections.Generic.IEnumerator<> that can be used to iterate through the collection. |
GetOrderedEnumerator()
Gets the ordered enumerator.
Declaration
public IEnumerator<T> GetOrderedEnumerator()
Returns
System.Collections.Generic.IEnumerator<T>
|
Implements
Remove(T)
Removes the specified item.
Declaration
public bool Remove(T item)
Parameters
T
item
The item. |
Returns
System.Boolean
|
RemoveItem(T)
Removes the item from the tree.
Declaration
protected abstract bool RemoveItem(T item)
Parameters
T
item
The item to remove. |
Returns
System.Boolean
An indication of whether the item has been removed from the tree. |