Class
BinarySearchTreeBase<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:

cs-api-definition
[SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")]
public abstract class BinarySearchTreeBase<T> : ISearchTree<T>, ICollection<T>, IEnumerable<T>, IEnumerable

Inheritance: objectBinarySearchTreeBase<T>

Derived Classes: RedBlackTree<T>

Implements: ICollection<T>IEnumerableIEnumerable<T>ISearchTree<T>

Constructors

BinarySearchTreeBase()

Initializes a new instance of the BinarySearchTreeBase<T> class.

Declaration

cs-api-definition
protected BinarySearchTreeBase()

BinarySearchTreeBase(Comparison<T>)

Initializes a new instance of the BinarySearchTreeBase<T> class.

Declaration

cs-api-definition
protected BinarySearchTreeBase(Comparison<T> comparison)

Parameters

comparison

Comparison<T>

The comparison.

BinarySearchTreeBase(IComparer<T>)

Initializes a new instance of the BinarySearchTreeBase<T> class.

Declaration

cs-api-definition
protected BinarySearchTreeBase(IComparer<T> comparer)

Parameters

comparer

IComparer<T>

The comparer to use when comparing items.

Exceptions

ArgumentNullException

comparer is a null reference (Nothing in Visual Basic).

Properties

Comparer

Gets the comparer.

Declaration

cs-api-definition
public IComparer<T> Comparer { get; }

Property Value

IComparer<T>

The comparer.

Count

Gets the count.

Declaration

cs-api-definition
public int Count { get; }

Property Value

int

Implements ICollection<T>.Count

Height

Gets the height.

Declaration

cs-api-definition
public int Height { get; }

Property Value

int

IsEmpty

Gets a value indicating whether this instance is empty.

Declaration

cs-api-definition
public bool IsEmpty { get; }

Property Value

bool

true if this instance is empty; otherwise, false.

IsReadOnly

Gets a value indicating whether this instance is read only.

Declaration

cs-api-definition
public bool IsReadOnly { get; }

Property Value

bool

true if this instance is read only; otherwise, false.

Implements ICollection<T>.IsReadOnly

Maximum

Gets the maximum.

Declaration

cs-api-definition
public virtual T Maximum { get; }

Property Value

T

Implements ISearchTree<T>.Maximum

Minimum

Gets the minimum.

Declaration

cs-api-definition
public virtual T Minimum { get; }

Property Value

T

Implements ISearchTree<T>.Minimum

Tree

Gets or sets the binary tree.

Declaration

cs-api-definition
[SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
protected BinaryTree<T> Tree { get; set; }

Property Value

BinaryTree<T>

Methods

Add(T)

Adds the specified item.

Declaration

cs-api-definition
public void Add(T item)

Parameters

item

T

The item.

Implements ICollection<T>.Add(T)

AddItem(T)

Adds the item.

Declaration

cs-api-definition
protected abstract void AddItem(T item)

Parameters

item

T

The item.

Clear()

Clears this instance.

Declaration

cs-api-definition
public void Clear()

Implements ICollection<T>.Clear()

ClearItems()

Clears all the objects in this instance.

Declaration

cs-api-definition
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

cs-api-definition
public virtual bool Contains(T item)

Parameters

item

T

The item.

Returns

bool

true if [contains] [the specified item]; otherwise, false.

Implements ICollection<T>.Contains(T)

CopyTo(T[], int)

Copies to.

Declaration

cs-api-definition
public void CopyTo(T[] array, int arrayIndex)

Parameters

array

T[]

The array.

arrayIndex

int

Index of the array.

Implements ICollection<T>.CopyTo(T[], int)

DepthFirstTraversal(IVisitor<T>)

Depth first search traversal.

Declaration

cs-api-definition
public void DepthFirstTraversal(IVisitor<T> visitor)

Parameters

visitor

IVisitor<T>

The visitor.

Implements ISearchTree<T>.DepthFirstTraversal(IVisitor<T>)

FindMaximumNode()

Find the maximum node.

Declaration

cs-api-definition
protected BinaryTree<T> FindMaximumNode()

Returns

BinaryTree<T>

The maximum node.

FindMaximumNode(BinaryTree<T>)

Finds the maximum node.

Declaration

cs-api-definition
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

cs-api-definition
protected BinaryTree<T> FindMinimumNode()

Returns

BinaryTree<T>

The minimum node.

FindMinimumNode(BinaryTree<T>)

Finds the minimum node.

Declaration

cs-api-definition
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

cs-api-definition
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

cs-api-definition
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

cs-api-definition
public IEnumerator<T> GetEnumerator()

Returns

IEnumerator<T>

A IEnumerator<T> that can be used to iterate through the collection.

Implements IEnumerable<T>.GetEnumerator()

GetOrderedEnumerator()

Gets the ordered enumerator.

Declaration

cs-api-definition
public IEnumerator<T> GetOrderedEnumerator()

Returns

IEnumerator<T>

Implements ISearchTree<T>.GetOrderedEnumerator()

Remove(T)

Removes the specified item.

Declaration

cs-api-definition
public bool Remove(T item)

Parameters

item

T

The item.

Returns

bool

Implements ICollection<T>.Remove(T)

RemoveItem(T)

Removes the item from the tree.

Declaration

cs-api-definition
protected abstract bool RemoveItem(T item)

Parameters

item

T

The item to remove.

Returns

bool

An indication of whether the item has been removed from the tree.