ClassBinarySearchTreeBase<T>
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:
[SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")]
public abstract class BinarySearchTreeBase<T> : ISearchTree<T>, ICollection<T>, IEnumerable<T>, IEnumerable
Inheritance: objectBinarySearchTreeBase<T>
Derived Classes:
Implements:
Constructors
BinarySearchTreeBase()
Initializes a new instance of the BinarySearchTreeBase<T> class.
Declaration
protected BinarySearchTreeBase()
BinarySearchTreeBase(Comparison<T>)
Initializes a new instance of the BinarySearchTreeBase<T> class.
Declaration
protected BinarySearchTreeBase(Comparison<T> comparison)
Parameters
comparison
Comparison<T>
The comparison.
BinarySearchTreeBase(IComparer<T>)
Initializes a new instance of the BinarySearchTreeBase<T> class.
Declaration
protected BinarySearchTreeBase(IComparer<T> comparer)
Parameters
comparer
IComparer<T>
The comparer to use when comparing items.
Exceptions
comparer is a null reference (Nothing in Visual Basic).
Properties
Comparer
Gets the comparer.
Declaration
public IComparer<T> Comparer { get; }
Property Value
IComparer<T>
The comparer.
Count
Gets the count.
IsEmpty
Gets a value indicating whether this instance is empty.
Declaration
public bool IsEmpty { get; }
Property Value
true if this instance is empty; otherwise, false.
IsReadOnly
Gets a value indicating whether this instance is read only.
Declaration
public bool IsReadOnly { get; }
Property Value
true if this instance is read only; otherwise, false.
Implements
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
[SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
protected BinaryTree<T> Tree { get; set; }
Property Value
BinaryTree<T>
Methods
Add(T)
Adds the specified item.
Declaration
public void Add(T item)
Parameters
item
T
The item.
Implements
AddItem(T)
Adds the item.
Declaration
protected abstract void AddItem(T item)
Parameters
item
T
The item.
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
item
T
The item.
Returns
true if [contains] [the specified item]; otherwise, false.
Implements
CopyTo(T[], int)
Copies to.
Declaration
public void CopyTo(T[] array, int arrayIndex)
Parameters
array
T[]
The array.
arrayIndex
Index of the array.
Implements
DepthFirstTraversal(IVisitor<T>)
Depth first search traversal.
Declaration
public void DepthFirstTraversal(IVisitor<T> visitor)
Parameters
visitor
IVisitor<T>
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
startNode
BinaryTree<T>
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
startNode
BinaryTree<T>
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
item
T
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, 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
value
TSearch
The value.
customComparison
BinarySearchTreeBase<T>.CustomComparison<TSearch>
The custom comparison.
Returns
BinaryTree<T>
The item if found, else null.
GetEnumerator()
Returns an enumerator that iterates through the collection.
Declaration
public IEnumerator<T> GetEnumerator()
Returns
IEnumerator<T>
A IEnumerator<T> that can be used to iterate through the collection.
Implements
GetOrderedEnumerator()
Gets the ordered enumerator.
Declaration
public IEnumerator<T> GetOrderedEnumerator()
Returns
IEnumerator<T>
Implements
Remove(T)
Removes the specified item.
Declaration
public bool Remove(T item)
Parameters
item
T
The item.
Returns
Implements
RemoveItem(T)
Removes the item from the tree.
Declaration
protected abstract bool RemoveItem(T item)
Parameters
item
T
The item to remove.
Returns
An indication of whether the item has been removed from the tree.