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.GuardedSortedDictionary< K, V > Class Template Reference

A read-only wrapper for a sorted dictionary. More...

Inheritance diagram for C5.GuardedSortedDictionary< K, V >:
C5.GuardedDictionary< K, V > C5.ISortedDictionary< K, V > C5.IDictionary< K, V > C5.IDictionary< K, V >

Public Member Functions

 GuardedSortedDictionary (ISortedDictionary< K, V > sorteddict)
 Wrap a sorted dictionary in a read-only wrapper More...
 
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 wrapped dictionary whose key is the predecessor of a specified key. More...
 
KeyValuePair< K, V > Successor (K key)
 Get the entry in the wrapped dictionary whose key is the successor of a specified key. More...
 
KeyValuePair< K, V > WeakPredecessor (K key)
 Get the entry in the wrapped dictionary whose key is the weak predecessor of a specified key. More...
 
KeyValuePair< K, V > WeakSuccessor (K key)
 Get the entry in the wrapped dictionary whose key is the weak successor of a specified key. More...
 
KeyValuePair< K, V > FindMin ()
 
KeyValuePair< K, V > DeleteMin ()
 
KeyValuePair< K, V > FindMax ()
 
KeyValuePair< K, V > DeleteMax ()
 
bool Cut (IComparable< K > c, 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 (System.Collections.Generic.IEnumerable< KeyValuePair< K, V >> items)
 
void RemoveRangeFrom (K low)
 
void RemoveRangeFromTo (K low, K hi)
 
void RemoveRangeTo (K hi)
 
- Public Member Functions inherited from C5.GuardedDictionary< K, V >
 GuardedDictionary (IDictionary< K, V > dict)
 Wrap a dictionary in a read-only wrapper More...
 
void Add (K key, V val)
 
void AddAll< L, W > (SCG.IEnumerable< KeyValuePair< L, W >> items)
 
bool Remove (K key)
 
bool Remove (K key, out V val)
 
void Clear ()
 
bool Contains (K key)
 Check if the wrapped dictionary contains a specific key More...
 
bool ContainsAll< H > (SCG.IEnumerable< H > keys)
 
bool Find (ref K key, out V val)
 Search for a key in the wrapped dictionary, reporting the value if found More...
 
bool Update (K key, V val)
 
bool Update (K key, V val, out V oldval)
 
bool FindOrAdd (K key, ref V val)
 
bool UpdateOrAdd (K key, V val)
 
bool UpdateOrAdd (K key, V val, out V oldval)
 
bool Check ()
 Check the internal consistency of the wrapped dictionary More...
 
- 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...
 

Properties

SCG.IComparer< K > Comparer [get]
 The key comparer used by this dictionary. More...
 
new ISorted< K > Keys [get]
 
- Properties inherited from C5.GuardedDictionary< K, V >
SCG.IEqualityComparer< K > EqualityComparer [get]
 
this[K key] [get, set]
 
bool IsReadOnly [get]
 (This is a read-only wrapper) More...
 
ICollectionValue< K > Keys [get]
 
ICollectionValue< V > Values [get]
 
virtual Func< K, V > Func [get]
 
Speed ContainsSpeed [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 read-only wrapper for a sorted dictionary.

Suitable for wrapping a Dictionary. T:C5.Dictionary`2

Constructor & Destructor Documentation

Wrap a sorted dictionary in a read-only wrapper

Parameters
sorteddictthe dictionary

Member Function Documentation

void C5.GuardedSortedDictionary< K, V >.AddSorted ( System.Collections.Generic.IEnumerable< KeyValuePair< K, V >>  items)

Exceptions
ReadOnlyCollectionExceptionsince this is a read-only wrapper
Parameters
items

Implements C5.ISortedDictionary< K, V >.

bool C5.GuardedSortedDictionary< K, V >.Cut ( IComparable< K >  c,
out KeyValuePair< K, V >  lowEntry,
out bool  lowIsValid,
out KeyValuePair< K, V >  highEntry,
out bool  highIsValid 
)

Parameters
c
lowEntry
lowIsValid
highEntry
highIsValid
Returns

Implements C5.ISortedDictionary< K, V >.

KeyValuePair<K, V> C5.GuardedSortedDictionary< K, V >.DeleteMax ( )

Exceptions
ReadOnlyCollectionExceptionsince this is a read-only wrapper
Returns

Implements C5.ISortedDictionary< K, V >.

KeyValuePair<K, V> C5.GuardedSortedDictionary< K, V >.DeleteMin ( )

Exceptions
ReadOnlyCollectionExceptionsince this is a read-only wrapper
Returns

Implements C5.ISortedDictionary< K, V >.

KeyValuePair<K, V> C5.GuardedSortedDictionary< K, V >.FindMax ( )

Returns

Implements C5.ISortedDictionary< K, V >.

KeyValuePair<K, V> C5.GuardedSortedDictionary< K, V >.FindMin ( )

Returns

Implements C5.ISortedDictionary< K, V >.

KeyValuePair<K, V> C5.GuardedSortedDictionary< K, V >.Predecessor ( key)

Get the entry in the wrapped dictionary whose key is the predecessor of a specified key.

Exceptions
NoSuchItemExceptionif no such entry exists
Parameters
keyThe key
Returns
The entry

Implements C5.ISortedDictionary< K, V >.

IDirectedEnumerable<KeyValuePair<K, V> > C5.GuardedSortedDictionary< K, V >.RangeFrom ( bot)

Parameters
bot
Returns

Implements C5.ISortedDictionary< K, V >.

IDirectedEnumerable<KeyValuePair<K, V> > C5.GuardedSortedDictionary< K, V >.RangeFromTo ( bot,
top 
)

Parameters
bot
top
Returns

Implements C5.ISortedDictionary< K, V >.

IDirectedEnumerable<KeyValuePair<K, V> > C5.GuardedSortedDictionary< K, V >.RangeTo ( top)

Parameters
top
Returns

Implements C5.ISortedDictionary< K, V >.

void C5.GuardedSortedDictionary< K, V >.RemoveRangeFrom ( low)

Exceptions
ReadOnlyCollectionExceptionsince this is a read-only wrapper
Parameters
low

Implements C5.ISortedDictionary< K, V >.

void C5.GuardedSortedDictionary< K, V >.RemoveRangeFromTo ( low,
hi 
)

Exceptions
ReadOnlyCollectionExceptionsince this is a read-only wrapper
Parameters
low
hi

Implements C5.ISortedDictionary< K, V >.

void C5.GuardedSortedDictionary< K, V >.RemoveRangeTo ( hi)

Exceptions
ReadOnlyCollectionExceptionsince this is a read-only wrapper
Parameters
hi

Implements C5.ISortedDictionary< K, V >.

KeyValuePair<K, V> C5.GuardedSortedDictionary< K, V >.Successor ( key)

Get the entry in the wrapped dictionary whose key is the successor of a specified key.

Exceptions
NoSuchItemExceptionif no such entry exists
Parameters
keyThe key
Returns
The entry

Implements C5.ISortedDictionary< K, V >.

bool C5.GuardedSortedDictionary< K, V >.TryPredecessor ( key,
out KeyValuePair< K, V >  res 
)

Find the entry in the dictionary whose key is the predecessor of the specified key.

Parameters
keyThe key
resThe predecessor, if any
Returns
True if key has a predecessor

Implements C5.ISortedDictionary< K, V >.

bool C5.GuardedSortedDictionary< K, V >.TrySuccessor ( key,
out KeyValuePair< K, V >  res 
)

Find the entry in the dictionary whose key is the successor of the specified key.

Parameters
keyThe key
resThe successor, if any
Returns
True if the key has a successor

Implements C5.ISortedDictionary< K, V >.

bool C5.GuardedSortedDictionary< K, V >.TryWeakPredecessor ( key,
out KeyValuePair< K, V >  res 
)

Find the entry in the dictionary whose key is the weak predecessor of the specified key.

Parameters
keyThe key
resThe predecessor, if any
Returns
True if key has a weak predecessor

Implements C5.ISortedDictionary< K, V >.

bool C5.GuardedSortedDictionary< K, V >.TryWeakSuccessor ( key,
out KeyValuePair< K, V >  res 
)

Find the entry in the dictionary whose key is the weak successor of the specified key.

Parameters
keyThe key
resThe weak successor, if any
Returns
True if the key has a weak successor

Implements C5.ISortedDictionary< K, V >.

KeyValuePair<K, V> C5.GuardedSortedDictionary< K, V >.WeakPredecessor ( key)

Get the entry in the wrapped dictionary whose key is the weak predecessor of a specified key.

Exceptions
NoSuchItemExceptionif no such entry exists
Parameters
keyThe key
Returns
The entry

Implements C5.ISortedDictionary< K, V >.

KeyValuePair<K, V> C5.GuardedSortedDictionary< K, V >.WeakSuccessor ( key)

Get the entry in the wrapped dictionary whose key is the weak successor of a specified key.

Exceptions
NoSuchItemExceptionif no such entry exists
Parameters
keyThe key
Returns
The entry

Implements C5.ISortedDictionary< K, V >.

Property Documentation

SCG.IComparer<K> C5.GuardedSortedDictionary< K, V >.Comparer
get

The key comparer used by this dictionary.

new ISorted<K> C5.GuardedSortedDictionary< K, V >.Keys
get


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