Com.Mission_Base.Pbl.AvlDictionary< TKey, TValue > Class Template Reference

AvlDictionary<TKey,TValue> is an implementation of the generic IDictionary<TKey,TValue> interface based on an AVL-tree. The AvlDictionary<TKey,TValue> represents a collection of key/value pairs that are sorted on the key. More...

List of all members.

Classes

class  AvlDictionaryBaseEnumerator
 Provides the common base functionality of all Enumerators used with an AvlDictionary<TKey,TValue>. More...
class  AvlTreeNode
 The actual AVL-tree code. It was lifted from the C implementation in pblSet.c.
class  Enumerator
 Enumerates the elements of an AvlDictionary<TKey,TValue>. More...
class  KeyCollection
 Represents the collection of keys in an AvlDictionary<TKey,TValue>. This class cannot be inherited. More...
class  ValueCollection
 Represents the collection of values in an AvlDictionary<TKey,TValue>. This class cannot be inherited. More...

Public Member Functions

 AvlDictionary ()
 Initializes a new instance of the AvlDictionary<TKey,TValue> class that is empty.
 AvlDictionary (IDictionary< TKey, TValue > dictionary)
 Initializes a new instance of the AvlDictionary<TKey,TValue> class that contains elements copied from the specified System.Collections.Generic.IDictionary<TKey,TValue>.
void Add (TKey key, TValue value)
 Adds the specified key and value to the AvlDictionary.
bool ContainsKey (TKey key)
 Determines whether the AvlDictionary contains the specified key.
bool Remove (TKey key)
 Removes the value with the specified key from the AvlDictionary.
bool TryGetValue (TKey key, out TValue value)
 Gets the value associated with the specified key.
void Add (KeyValuePair< TKey, TValue > item)
 Adds a KeyValuePair<TKey,TValue> to the AvlDictionary.
void Clear ()
 Removes all keys and values from the AvlDictionary.
bool Contains (KeyValuePair< TKey, TValue > item)
 Determines whether the AvlDictionary contains a specific KeyValuePair<TKey,TValue>.
void CopyTo (KeyValuePair< TKey, TValue >[] array, int arrayIndex)
 Copies the elements of the AvlDictionary to an existing one-dimensional KeyValuePair<TKey,TValue>[], starting at the specified array index.
bool Remove (KeyValuePair< TKey, TValue > item)
 Removes the first occurrence of a specific KeyValuePair<TKey,TValue> from the AvlDictionary.
IEnumerator< KeyValuePair
< TKey, TValue > > 
GetEnumerator ()
 Returns an enumerator that iterates through the AvlDictionary.
void CopyTo (Array array, int index)
 Copies the elements of the elements of the AvlDictionary to an System.Array, starting at a particular System.Array index.

Properties

ICollection< TKey > Keys [get]
 Gets a collection containing the keys in the AvlDictionary.
ICollection< TValue > Values [get]
 Gets a collection containing the values in the AvlDictionary.
TValue this [TKey key] [get, set]
 Gets or sets the value associated with the specified key.
int Count [get]
 Gets the number of elements contained in the AvlDictionary.
bool IsReadOnly [get]
 Gets a value indicating whether the AvlDictionary is read-only.
bool IsSynchronized [get]
 Gets a value indicating whether access to the AvlDictionary is synchronized (thread safe).
object SyncRoot [get]
 Gets an object that can be used to synchronize access to the AvlDictionary.

Detailed Description

template<TKey, TValue>
class Com::Mission_Base::Pbl::AvlDictionary< TKey, TValue >

AvlDictionary<TKey,TValue> is an implementation of the generic IDictionary<TKey,TValue> interface based on an AVL-tree. The AvlDictionary<TKey,TValue> represents a collection of key/value pairs that are sorted on the key.

Template Parameters:
TKey The type of keys in the dictionary.
TValue The type of values in the dictionary.
Type Constraints
TKey :IComparable<TKey> 

Constructor & Destructor Documentation

template<TKey , TValue >
Com.Mission_Base.Pbl.AvlDictionary< TKey, TValue >.AvlDictionary (  ) 

Initializes a new instance of the AvlDictionary<TKey,TValue> class that is empty.

template<TKey , TValue >
Com.Mission_Base.Pbl.AvlDictionary< TKey, TValue >.AvlDictionary ( IDictionary< TKey, TValue >  dictionary  ) 

Initializes a new instance of the AvlDictionary<TKey,TValue> class that contains elements copied from the specified System.Collections.Generic.IDictionary<TKey,TValue>.

Parameters:
dictionary The System.Collections.Generic.IDictionary<TKey,TValue> whose elements are copied to the new AvlDictionary<TKey,TValue>.

This method is an O(N * log N) operation, where N is dictionary.Count.

Exceptions:
System.ArgumentNullException dictionary is null.
System.ArgumentException dictionary contains one or more duplicate keys.

Member Function Documentation

template<TKey , TValue >
void Com.Mission_Base.Pbl.AvlDictionary< TKey, TValue >.Add ( KeyValuePair< TKey, TValue >  item  ) 

Adds a KeyValuePair<TKey,TValue> to the AvlDictionary.

Parameters:
item The KeyValuePair<TKey,TValue> to add to the AvlDictionary.

This method is an O(log N) operation, where N is the number of elements in the AvlDictionary.

Exceptions:
System.NotSupportedException The AvlDictionary is read-only.
System.ArgumentException An element with the same key already exists in the AvlDictionary.
template<TKey , TValue >
void Com.Mission_Base.Pbl.AvlDictionary< TKey, TValue >.Add ( TKey  key,
TValue  value 
)

Adds the specified key and value to the AvlDictionary.

Parameters:
key The key of the element to add.
value The value of the element to add. The value can be null for reference types.

This method is an O(log N) operation, where N is the number of elements in the AvlDictionary.

Exceptions:
System.ArgumentNullException key is null.
System.ArgumentException An element with the same key already exists in the AvlDictionary.
template<TKey , TValue >
void Com.Mission_Base.Pbl.AvlDictionary< TKey, TValue >.Clear (  ) 

Removes all keys and values from the AvlDictionary.

Exceptions:
System.NotSupportedException The AvlDictionary is read-only.
template<TKey , TValue >
bool Com.Mission_Base.Pbl.AvlDictionary< TKey, TValue >.Contains ( KeyValuePair< TKey, TValue >  item  ) 

Determines whether the AvlDictionary contains a specific KeyValuePair<TKey,TValue>.

Parameters:
item The KeyValuePair<TKey,TValue> to locate in the AvlDictionary.

This method is an O(log N) operation, where N is the number of elements in the AvlDictionary.

Returns:
true if item is found in the AvlDictionary; otherwise, false.
template<TKey , TValue >
bool Com.Mission_Base.Pbl.AvlDictionary< TKey, TValue >.ContainsKey ( TKey  key  ) 

Determines whether the AvlDictionary contains the specified key.

Parameters:
key The key to locate in the AvlDictionary.

This method is an O(log N) operation, where N is the number of elements in the AvlDictionary.

Returns:
true if the AvlDictionary contains an element with the specified key; otherwise, false.
Exceptions:
System.ArgumentNullException key is null.
template<TKey , TValue >
void Com.Mission_Base.Pbl.AvlDictionary< TKey, TValue >.CopyTo ( Array  array,
int  index 
)

Copies the elements of the elements of the AvlDictionary to an System.Array, starting at a particular System.Array index.

Parameters:
array The one-dimensional System.Array that is the destination of the elements copied from AvlDictionary. The System.Array must have zero-based indexing.
index The zero-based index in array at which copying begins.
Exceptions:
System.ArgumentNullException array is null.
System.ArgumentOutOfRangeException index is less than zero.
System.ArgumentException array is multidimensional. -or- index is equal to or greater than the length of array. -or- The number of elements in the source AvlDictionary is greater than the available space from index to the end of the destination array.
template<TKey , TValue >
void Com.Mission_Base.Pbl.AvlDictionary< TKey, TValue >.CopyTo ( KeyValuePair< TKey, TValue >[]  array,
int  arrayIndex 
)

Copies the elements of the AvlDictionary to an existing one-dimensional KeyValuePair<TKey,TValue>[], starting at the specified array index.

Parameters:
array The one-dimensional KeyValuePair<TKey,TValue>[] that is the destination of the elements copied from AvlDictionary. The array must have zero-based indexing.
arrayIndex The zero-based index in array at which copying begins.
Exceptions:
System.ArgumentNullException array is null.
System.ArgumentOutOfRangeException arrayIndex is less than zero.
System.ArgumentException arrayIndex is equal to or greater than the length of array. -or- The number of elements in the source AvlDictionary is greater than the available space from arrayIndex to the end of the destination array.
template<TKey , TValue >
IEnumerator<KeyValuePair<TKey, TValue> > Com.Mission_Base.Pbl.AvlDictionary< TKey, TValue >.GetEnumerator (  ) 

Returns an enumerator that iterates through the AvlDictionary.

Returns:
An IEnumerator<KeyValuePair<TKey, TValue>> enumerator for the AvlDictionary.
template<TKey , TValue >
bool Com.Mission_Base.Pbl.AvlDictionary< TKey, TValue >.Remove ( KeyValuePair< TKey, TValue >  item  ) 

Removes the first occurrence of a specific KeyValuePair<TKey,TValue> from the AvlDictionary.

Parameters:
item The KeyValuePair<TKey,TValue> to remove from the AvlDictionary.

This method is an O(log N) operation, where N is the number of elements in the AvlDictionary.

Returns:
true if item was successfully removed from the AvlDictionary; otherwise, false. This method also returns false if item is not found in the original AvlDictionary.
Exceptions:
System.NotSupportedException The AvlDictionary is read-only.
template<TKey , TValue >
bool Com.Mission_Base.Pbl.AvlDictionary< TKey, TValue >.Remove ( TKey  key  ) 

Removes the value with the specified key from the AvlDictionary.

Parameters:
key The key of the element to remove.

This method is an O(log N) operation, where N is the number of elements in the AvlDictionary.

Returns:
true if the element is successfully found and removed; otherwise, false. This method returns false if key is not found in the AvlDictionary.
Exceptions:
System.ArgumentNullException key is null.
System.NotSupportedException "The AvlDictionary is read-only."
template<TKey , TValue >
bool Com.Mission_Base.Pbl.AvlDictionary< TKey, TValue >.TryGetValue ( TKey  key,
out TValue  value 
)

Gets the value associated with the specified key.

Parameters:
key The key of the value to get.
value When this method returns, contains the value associated with the specified key, if the key is found; otherwise, the default value for the type of the value parameter. This parameter is passed uninitialized.

This method is an O(log N) operation, where N is the number of elements in the AvlDictionary.

Returns:
true if the AvlDictionary contains an element with the specified key; otherwise, false.
Exceptions:
System.ArgumentNullException key is null.

Property Documentation

template<TKey , TValue >
int Com.Mission_Base.Pbl.AvlDictionary< TKey, TValue >.Count [get]

Gets the number of elements contained in the AvlDictionary.

Returns:
The number of elements contained in the AvlDictionary. Retrieving the value of this property is an O(1) operation.
template<TKey , TValue >
bool Com.Mission_Base.Pbl.AvlDictionary< TKey, TValue >.IsReadOnly [get]

Gets a value indicating whether the AvlDictionary is read-only.

Returns:
false.
template<TKey , TValue >
bool Com.Mission_Base.Pbl.AvlDictionary< TKey, TValue >.IsSynchronized [get]

Gets a value indicating whether access to the AvlDictionary is synchronized (thread safe).

Returns:
false.
template<TKey , TValue >
ICollection<TKey> Com.Mission_Base.Pbl.AvlDictionary< TKey, TValue >.Keys [get]

Gets a collection containing the keys in the AvlDictionary.

Returns:
An ICollection<TKey> containing the keys in the AvlDictionary.
template<TKey , TValue >
object Com.Mission_Base.Pbl.AvlDictionary< TKey, TValue >.SyncRoot [get]

Gets an object that can be used to synchronize access to the AvlDictionary.

Returns:
An object that can be used to synchronize access to the AvlDictionary.
template<TKey , TValue >
TValue Com.Mission_Base.Pbl.AvlDictionary< TKey, TValue >.this[TKey key] [get, set]

Gets or sets the value associated with the specified key.

Parameters:
key The key of the value to get or set.

This method is an O(log N) operation, where N is the number of elements in the AvlDictionary.

Returns:
The value associated with the specified key. If the specified key is not found, a get operation throws a System.Collections.Generic.KeyNotFoundException, and a set operation creates a new element with the specified key.
Exceptions:
System.ArgumentNullException key is null.
System.Collections.Generic.KeyNotFoundException The property is retrieved and key does not exist in the collection.
System.Collections.Generic.NotSupportedException The property is set and the AvlDictionary is read-only.
template<TKey , TValue >
ICollection<TValue> Com.Mission_Base.Pbl.AvlDictionary< TKey, TValue >.Values [get]

Gets a collection containing the values in the AvlDictionary.

Returns:
An ICollection<TValue> containing the values in the AvlDictionary.

The documentation for this class was generated from the following file:

Generated on Thu Nov 26 15:25:32 2009 for AvlDictionary by  doxygen 1.6.1