Class
RedBlackTree<TKey, TValue>

A red–black tree is a type of self-balancing binary search tree, a data structure used in computer science, typically to implement associative arrays.

Definition

Namespace:Telerik.Windows.Diagrams.Core

Assembly:Telerik.Windows.Diagrams.Core.dll

Type Parameters:

TKey

The type of the key.

TValue

The type of the value.

Syntax:

cs-api-definition
[SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")]
public class RedBlackTree<TKey, TValue> : RedBlackTree<KeyValuePair<TKey, TValue>>, ISearchTree<KeyValuePair<TKey, TValue>>, IDictionary<TKey, TValue>, ICollection<KeyValuePair<TKey, TValue>>, IEnumerable<KeyValuePair<TKey, TValue>>, IEnumerable

Inheritance: objectBinarySearchTreeBase<KeyValuePair<TKey, TValue>>RedBlackTree<KeyValuePair<TKey, TValue>>RedBlackTree<TKey, TValue>

Implements: ICollection<KeyValuePair<TKey, TValue>>IDictionary<TKey, TValue>IEnumerableIEnumerable<KeyValuePair<TKey, TValue>>ISearchTree<KeyValuePair<TKey, TValue>>

Inherited Members RedBlackTree<KeyValuePair<TKey, TValue>>.AddItem(KeyValuePair<TKey, TValue>)RedBlackTree<KeyValuePair<TKey, TValue>>.RemoveItem(KeyValuePair<TKey, TValue>)BinarySearchTreeBase<KeyValuePair<TKey, TValue>>.Add(KeyValuePair<TKey, TValue>)BinarySearchTreeBase<KeyValuePair<TKey, TValue>>.Clear()BinarySearchTreeBase<KeyValuePair<TKey, TValue>>.Contains(KeyValuePair<TKey, TValue>)BinarySearchTreeBase<KeyValuePair<TKey, TValue>>.CopyTo(KeyValuePair<TKey, TValue>[], int)BinarySearchTreeBase<KeyValuePair<TKey, TValue>>.DepthFirstTraversal(IVisitor<KeyValuePair<TKey, TValue>>)BinarySearchTreeBase<KeyValuePair<TKey, TValue>>.GetEnumerator()BinarySearchTreeBase<KeyValuePair<TKey, TValue>>.GetOrderedEnumerator()BinarySearchTreeBase<KeyValuePair<TKey, TValue>>.Remove(KeyValuePair<TKey, TValue>)BinarySearchTreeBase<KeyValuePair<TKey, TValue>>.FindMaximumNode(BinaryTree<KeyValuePair<TKey, TValue>>)BinarySearchTreeBase<KeyValuePair<TKey, TValue>>.FindMinimumNode(BinaryTree<KeyValuePair<TKey, TValue>>)BinarySearchTreeBase<KeyValuePair<TKey, TValue>>.ClearItems()BinarySearchTreeBase<KeyValuePair<TKey, TValue>>.FindMaximumNode()BinarySearchTreeBase<KeyValuePair<TKey, TValue>>.FindMinimumNode()BinarySearchTreeBase<KeyValuePair<TKey, TValue>>.FindNode(KeyValuePair<TKey, TValue>)BinarySearchTreeBase<KeyValuePair<TKey, TValue>>.FindNode<TSearch>(TSearch, BinarySearchTreeBase<KeyValuePair<TKey, TValue>>.CustomComparison<TSearch>)BinarySearchTreeBase<KeyValuePair<TKey, TValue>>.ComparerBinarySearchTreeBase<KeyValuePair<TKey, TValue>>.CountBinarySearchTreeBase<KeyValuePair<TKey, TValue>>.IsEmptyBinarySearchTreeBase<KeyValuePair<TKey, TValue>>.IsReadOnlyBinarySearchTreeBase<KeyValuePair<TKey, TValue>>.HeightBinarySearchTreeBase<KeyValuePair<TKey, TValue>>.MaximumBinarySearchTreeBase<KeyValuePair<TKey, TValue>>.MinimumBinarySearchTreeBase<KeyValuePair<TKey, TValue>>.Tree

Constructors

RedBlackTree()

Initializes a new instance of the RedBlackTree<TKey, TValue> class.

Declaration

cs-api-definition
public RedBlackTree()

RedBlackTree(Comparison<TKey>)

Initializes a new instance of the RedBlackTree<TKey, TValue> class.

Declaration

cs-api-definition
public RedBlackTree(Comparison<TKey> comparison)

Parameters

comparison

Comparison<TKey>

The comparison.

RedBlackTree(IComparer<TKey>)

Initializes a new instance of the RedBlackTree<TKey, TValue> class.

Declaration

cs-api-definition
public RedBlackTree(IComparer<TKey> comparer)

Parameters

comparer

IComparer<TKey>

The comparer.

Properties

Keys

Gets an ICollection<T> containing the keys of the IDictionary<TKey, TValue>.

Declaration

cs-api-definition
public ICollection<TKey> Keys { get; }

Property Value

ICollection<TKey>

Implements IDictionary<TKey, TValue>.Keys

Values

Gets an ICollection<T> containing the values in the IDictionary<TKey, TValue>.

Declaration

cs-api-definition
public ICollection<TValue> Values { get; }

Property Value

ICollection<TValue>

Implements IDictionary<TKey, TValue>.Values

this[TKey]

Gets or sets the value with the specified key.

Declaration

cs-api-definition
public TValue this[TKey key] { get; set; }

Parameters

key

TKey

Property Value

TValue

The key of the item to set or get.

Implements IDictionary<TKey, TValue>.this[TKey]

Methods

Add(TKey, TValue)

Adds an element with the provided key and value to the IDictionary<TKey, TValue>.

Declaration

cs-api-definition
public void Add(TKey key, TValue value)

Parameters

key

TKey

The object to use as the key of the element to add.

value

TValue

The object to use as the value of the element to add.

Implements IDictionary<TKey, TValue>.Add(TKey, TValue)

Contains(KeyValuePair<TKey, TValue>)

Determines whether this tree contains the given item.

Declaration

cs-api-definition
public override bool Contains(KeyValuePair<TKey, TValue> item)

Parameters

item

KeyValuePair<TKey, TValue>

The item.

Returns

bool

true if the item is in this tree; otherwise, false.

Overrides BinarySearchTreeBase<KeyValuePair<TKey, TValue>>.Contains(KeyValuePair<TKey, TValue>)

Implements ICollection<KeyValuePair<TKey, TValue>>.Contains(KeyValuePair<TKey, TValue>)

ContainsKey(TKey)

Determines whether the IDictionary<TKey, TValue> contains an element with the specified key.

Declaration

cs-api-definition
public bool ContainsKey(TKey key)

Parameters

key

TKey

The key to locate in the IDictionary<TKey, TValue>.

Returns

bool

True if the IDictionary<TKey, TValue> contains an element with the key; otherwise, false.

Exceptions

ArgumentNullException

key is null.

Implements IDictionary<TKey, TValue>.ContainsKey(TKey)

Remove(TKey)

Removes the element with the specified key from the IDictionary<TKey, TValue>.

Declaration

cs-api-definition
public bool Remove(TKey key)

Parameters

key

TKey

The key of the element to remove.

Returns

bool

True if the element is successfully removed; otherwise, false. This method also returns false if key was not found in the original IDictionary<TKey, TValue>.

Exceptions

ArgumentNullException

key is null.

NotSupportedException

The IDictionary<TKey, TValue> is read-only.

Implements IDictionary<TKey, TValue>.Remove(TKey)

TryGetValue(TKey, out TValue)

Attempts to the get value.

Declaration

cs-api-definition
public bool TryGetValue(TKey key, out TValue value)

Parameters

key

TKey

The key.

value

TValue

The value.

Returns

bool

Implements IDictionary<TKey, TValue>.TryGetValue(TKey, out TValue)