C5  2.4
The C5 Generic Collection Library for C# and CLI is a comprehensive collection library supporting lists, sets, bags, dictionaries, priority queues, (FIFO) queues, and (LIFO) stacks. C5 runs on .NET 3.5+, Silverlight 5, Windows Phone 8, Xamarin.iOS, Xamarin.Android, and Mono.
C5.TreeDictionary< K, V > Class Template Reference

A sorted generic dictionary based on a red-black tree set. More...

Inheritance diagram for C5.TreeDictionary< K, V >:
C5.SortedDictionaryBase< K, V > C5.IDictionary< K, V > C5.ISortedDictionary< K, V > C5.DictionaryBase< K, V > C5.ISortedDictionary< K, V > C5.IDictionary< K, V > C5.IDictionary< K, V > C5.IDictionary< K, V >

Public Member Functions

 TreeDictionary ()
 Create a red-black tree dictionary using the natural comparer for keys.

Exceptions
ArgumentExceptionif the key type K is not comparable.
More...
 
 TreeDictionary (SCG.IComparer< K > comparer)
 Create a red-black tree dictionary using an external comparer for keys. More...
 
SCG.IEnumerable< KeyValuePair< K, V > > Snapshot ()
 Make a snapshot of the current state of this dictionary More...
 
- Public Member Functions inherited from C5.SortedDictionaryBase< K, V >
bool TryPredecessor (K key, out KeyValuePair< K, V > res)
 Find the entry in the dictionary whose key is the predecessor of the specified key. More...
 
bool TrySuccessor (K key, out KeyValuePair< K, V > res)
 Find the entry in the dictionary whose key is the successor of the specified key. More...
 
bool TryWeakPredecessor (K key, out KeyValuePair< K, V > res)
 Find the entry in the dictionary whose key is the weak predecessor of the specified key. More...
 
bool TryWeakSuccessor (K key, out KeyValuePair< K, V > res)
 Find the entry in the dictionary whose key is the weak successor of the specified key. More...
 
KeyValuePair< K, V > Predecessor (K key)
 Get the entry in the dictionary whose key is the predecessor of the specified key. More...
 
KeyValuePair< K, V > Successor (K key)
 Get the entry in the dictionary whose key is the successor of the specified key. More...
 
KeyValuePair< K, V > WeakPredecessor (K key)
 Get the entry in the dictionary whose key is the weak predecessor of the specified key. More...
 
KeyValuePair< K, V > WeakSuccessor (K key)
 Get the entry in the dictionary whose key is the weak successor of the specified key. More...
 
KeyValuePair< K, V > FindMin ()
 
KeyValuePair< K, V > DeleteMin ()
 
KeyValuePair< K, V > FindMax ()
 
KeyValuePair< K, V > DeleteMax ()
 
bool Cut (IComparable< K > cutter, out KeyValuePair< K, V > lowEntry, out bool lowIsValid, out KeyValuePair< K, V > highEntry, out bool highIsValid)
 
IDirectedEnumerable< KeyValuePair< K, V > > RangeFrom (K bot)
 
IDirectedEnumerable< KeyValuePair< K, V > > RangeFromTo (K bot, K top)
 
IDirectedEnumerable< KeyValuePair< K, V > > RangeTo (K top)
 
IDirectedCollectionValue< KeyValuePair< K, V > > RangeAll ()
 
void AddSorted (SCG.IEnumerable< KeyValuePair< K, V >> items)
 
void RemoveRangeFrom (K lowKey)
 
void RemoveRangeFromTo (K lowKey, K highKey)
 
void RemoveRangeTo (K highKey)
 
override bool Show (System.Text.StringBuilder stringbuilder, ref int rest, IFormatProvider formatProvider)
 
- Public Member Functions inherited from C5.DictionaryBase< K, V >
virtual void Add (K key, V value)
 Add a new (key, value) pair (a mapping) to the dictionary. More...
 
virtual void AddAll< L, W > (SCG.IEnumerable< KeyValuePair< L, W >> entries)
 Add the entries from a collection of T:C5.KeyValuePair`2 pairs to this dictionary. More...
 
virtual bool Remove (K key)
 Remove an entry with a given key from the dictionary More...
 
virtual bool Remove (K key, out V value)
 Remove an entry with a given key from the dictionary and report its value. More...
 
virtual void Clear ()
 Remove all entries from the dictionary More...
 
virtual bool Contains (K key)
 Check if there is an entry with a specified key More...
 
virtual bool ContainsAll< H > (SCG.IEnumerable< H > keys)
 
virtual bool Find (ref K key, out V value)
 Check if there is an entry with a specified key and report the corresponding value if found. This can be seen as a safe form of "val = this[key]". More...
 
virtual bool Update (K key, V value)
 Look for a specific key in the dictionary and if found replace the value with a new one. This can be seen as a non-adding version of "this[key] = val". More...
 
virtual bool Update (K key, V value, out V oldvalue)
 
virtual bool FindOrAdd (K key, ref V value)
 Look for a specific key in the dictionary. If found, report the corresponding value, else add an entry with the key and the supplied value. More...
 
virtual bool UpdateOrAdd (K key, V value)
 Update value in dictionary corresponding to key if found, else add new entry. More general than "this[key] = val;" by reporting if key was found. More...
 
virtual bool UpdateOrAdd (K key, V value, out V oldvalue)
 Update value in dictionary corresponding to key if found, else add new entry. More general than "this[key] = val;" by reporting if key was found and the old value if any. More...
 
virtual bool Check ()
 Check the integrity of the internal data structures of this dictionary. More...
 
override KeyValuePair< K, V > Choose ()
 Choose some entry in this Dictionary. More...
 
override SCG.IEnumerator< KeyValuePair< K, V > > GetEnumerator ()
 Create an enumerator for the collection of entries of the dictionary More...
 
override bool Show (System.Text.StringBuilder stringbuilder, ref int rest, IFormatProvider formatProvider)
 
- Public Member Functions inherited from C5.IDictionary< K, V >
void AddAll< U, W > (SCG.IEnumerable< KeyValuePair< U, W >> entries)
 Add the entries from a collection of T:C5.KeyValuePair`2 pairs to this dictionary. More...
 

Additional Inherited Members

- Protected Member Functions inherited from C5.SortedDictionaryBase< K, V >
 SortedDictionaryBase (SCG.IComparer< K > keycomparer, SCG.IEqualityComparer< K > keyequalityComparer)
 
- Protected Member Functions inherited from C5.DictionaryBase< K, V >
 DictionaryBase (SCG.IEqualityComparer< K > keyequalityComparer)
 
- Protected Attributes inherited from C5.SortedDictionaryBase< K, V >
ISorted< KeyValuePair< K, V > > sortedpairs
 
- Protected Attributes inherited from C5.DictionaryBase< K, V >
ICollection< KeyValuePair< K, V > > pairs
 The set collection of entries underlying this dictionary implementation More...
 
- Properties inherited from C5.SortedDictionaryBase< K, V >
SCG.IComparer< K > Comparer [get]
 The key comparer used by this dictionary. More...
 
new ISorted< K > Keys [get]
 
- Properties inherited from C5.DictionaryBase< K, V >
override CollectionChangedHandler< KeyValuePair< K, V > > CollectionChanged
 The change event. Will be raised for every change operation on the collection. More...
 
override CollectionClearedHandler< KeyValuePair< K, V > > CollectionCleared
 The change event. Will be raised for every change operation on the collection. More...
 
override ItemsAddedHandler< KeyValuePair< K, V > > ItemsAdded
 The item added event. Will be raised for every individual addition to the collection. More...
 
override ItemsRemovedHandler< KeyValuePair< K, V > > ItemsRemoved
 The item added event. Will be raised for every individual removal from the collection. More...
 
override EventTypeEnum ListenableEvents [get]
 
override EventTypeEnum ActiveEvents [get]
 
virtual SCG.IEqualityComparer< K > EqualityComparer [get]
 
virtual Speed ContainsSpeed [get]
 
virtual ICollectionValue< K > Keys [get]
 
virtual ICollectionValue< V > Values [get]
 
virtual Func< K, V > Func [get]
 
virtual V this[K key] [get, set]
 Indexer by key for dictionary. More...
 
virtual bool IsReadOnly [get]
 
override bool IsEmpty [get]
 
override int Count [get]
 
override Speed CountSpeed [get]
 
- Properties inherited from C5.IDictionary< K, V >
SCG.IEqualityComparer< K > EqualityComparer [get]
 The key equalityComparer. More...
 
this[K key] [get, set]
 Indexer for dictionary. More...
 
bool IsReadOnly [get]
 
ICollectionValue< K > Keys [get]
 
ICollectionValue< V > Values [get]
 
Func< K, V > Func [get]
 
Speed ContainsSpeed [get]
 The value is symbolic indicating the type of asymptotic complexity in terms of the size of this collection (worst-case or amortized as relevant). More...
 
- Properties inherited from C5.ISortedDictionary< K, V >
new ISorted< K > Keys [get]
 
SCG.IComparer< K > Comparer [get]
 The key comparer used by this dictionary. More...
 

Detailed Description

A sorted generic dictionary based on a red-black tree set.

Constructor & Destructor Documentation

Create a red-black tree dictionary using the natural comparer for keys.

Exceptions
ArgumentExceptionif the key type K is not comparable.

C5.TreeDictionary< K, V >.TreeDictionary ( SCG.IComparer< K >  comparer)

Create a red-black tree dictionary using an external comparer for keys.

Parameters
comparerThe external comparer

Member Function Documentation

SCG.IEnumerable<KeyValuePair<K, V> > C5.TreeDictionary< K, V >.Snapshot ( )

Make a snapshot of the current state of this dictionary

Returns
The snapshot

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