A void AddSorted(System.Collections.Generic.IEnumerable<KeyValuePair<K,V>> items) |
Add all the items from another collection with an enumeration order that
is increasing in the items.
Throws | | System.ArgumentException | if the enumerated items turns out
not to be in increasing order. |
Parameters: | items: | The collection to add. |
|
A bool Cut(System.IComparable<K> cutFunction, out KeyValuePair<K,V> lowEntry, out bool lowIsValid, out KeyValuePair<K,V> highEntry, out bool highIsValid) |
Given a "cut" function from the items of the sorted collection to int
whose only sign changes when going through items in increasing order
can be
- from positive to zero
- from positive to negative
- from zero to negative
The "cut" function is supplied as the CompareTo method
of an object c implementing
IComparable<K> .
A typical example is the case where K is comparable and
c is itself of type K .
This method performs a search in the sorted collection for the ranges in which the
"cut" function is negative, zero respectively positive. If K is comparable
and c is of type K , this is a safe way (no exceptions thrown)
to find predecessor and successor of c .
If the supplied cut function does not satisfy the sign-change condition,
the result of this call is undefined.
Returns: | True if the cut function is zero somewhere
on this collection. | Parameters: | cutFunction: | The cut function K to int , given
by the CompareTo method of an object implementing
IComparable<K> . | lowEntry: | Returns the largest item in the collection, where the
cut function is positive (if any). | lowIsValid: | Returns true if the cut function is positive somewhere
on this collection. | highEntry: | Returns the least item in the collection, where the
cut function is negative (if any). | highIsValid: | Returns true if the cut function is negative somewhere
on this collection. |
|
A KeyValuePair<K,V> DeleteMax() |
Remove the largest item from this sorted collection.
Returns: | The removed item. |
|
A KeyValuePair<K,V> DeleteMin() |
Remove the least item from this sorted collection.
Returns: | The removed item. |
|
A KeyValuePair<K,V> FindMax() |
Find the current largest item of this sorted collection.
Returns: | The largest item. |
|
A KeyValuePair<K,V> FindMin() |
Find the current least item of this sorted collection.
|
A KeyValuePair<K,V> Predecessor(K key) |
Find the entry with the largest key less than a given key.
Returns: | The entry | Parameters: | key: | The key to compare to |
|
A IDirectedCollectionValue<KeyValuePair<K,V>> RangeAll() |
Create a directed collection with the same items as this collection.
The returned collection is not a copy but a view into the collection. The view is fragile in the sense that changes to the underlying collection will
invalidate the view so that further operations on the view throws InvalidView exceptions. Returns: | The result directed collection. |
|
A IDirectedEnumerable<KeyValuePair<K,V>> RangeFrom(K bot) |
Query this sorted collection for items greater than or equal to a supplied value.
The returned collection is not a copy but a view into the collection. The view is fragile in the sense that changes to the underlying collection will
invalidate the view so that further operations on the view throws InvalidView exceptions. Returns: | The result directed collection. | Parameters: | bot: | The lower bound (inclusive). |
|
A IDirectedEnumerable<KeyValuePair<K,V>> RangeFromTo(K lowerBound, K upperBound) |
Query this sorted collection for items between two supplied values.
The returned collection is not a copy but a view into the collection. The view is fragile in the sense that changes to the underlying collection will
invalidate the view so that further operations on the view throws InvalidView exceptions. Returns: | The result directed collection. | Parameters: | lowerBound: | The lower bound (inclusive). | upperBound: | The upper bound (exclusive). |
|
A IDirectedEnumerable<KeyValuePair<K,V>> RangeTo(K top) |
Query this sorted collection for items less than a supplied value.
The returned collection is not a copy but a view into the collection. The view is fragile in the sense that changes to the underlying collection will
invalidate the view so that further operations on the view throws InvalidView exceptions. Returns: | The result directed collection. | Parameters: | top: | The upper bound (exclusive). |
|
A void RemoveRangeFrom(K low) |
Remove all items of this collection above or at a supplied threshold.
Parameters: | low: | The lower threshold (inclusive). |
|
A void RemoveRangeFromTo(K low, K hi) |
Remove all items of this collection between two supplied thresholds.
Parameters: | low: | The lower threshold (inclusive). | hi: | The upper threshold (exclusive). |
|
A void RemoveRangeTo(K hi) |
Remove all items of this collection below a supplied threshold.
Parameters: | hi: | The upper threshold (exclusive). |
|
A KeyValuePair<K,V> Successor(K key) |
Find the entry with the least key greater than a given key.
Returns: | The entry | Parameters: | key: | The key to compare to |
|
A KeyValuePair<K,V> WeakPredecessor(K key) |
Find the entry with the largest key less than or equal to a given key.
Returns: | The entry | Parameters: | key: | The key to compare to |
|
A KeyValuePair<K,V> WeakSuccessor(K key) |
Find the entry with the least key greater than or equal to a given key.
Returns: | The entry | Parameters: | key: | The key to compare to |
|