An sorted dictionary that is efficient for all operations and offers indexed access to its list of key-value pairs.
More...
An sorted dictionary that is efficient for all operations and offers indexed access to its list of key-value pairs.
An article about the BList classes is available.
The keys must be comparable (ordered); if the type does not implement IComparable
or IComparable(T)
, you must provide a Comparison(T) delegate to perform comparisons.
This class offers the following additional features beyond what's offered by the standard SortedDictionary{T} class: indexed access, a find-nearest- key operation called FindLowerBound (similar to lower_bound in C++), observability, fast cloning, freezability, fast cloning of an arbitrary range of items in a large collection, enumeration of part of the list (not just the entire list), and reverse enumeration, and a few compound operations.
Duplicate keys are not allowed in a BDictionary. If you would like to be able to associate multiple values with a single key, use BMultiMap{K,V} instead.
If you need to store only keys, not values, use BList{K} instead (but note that BList does allow duplicate keys).
|
| BDictionary () |
| Initializes an empty BList. More...
|
|
| BDictionary (int maxLeafSize) |
|
| BDictionary (int maxLeafSize, int maxInnerSize) |
|
| BDictionary (Func< K, K, int > compareKeys) |
|
| BDictionary (Func< K, K, int > compareKeys, int maxLeafSize) |
|
| BDictionary (Func< K, K, int > compareKeys, int maxLeafSize, int maxInnerSize) |
| Initializes an empty BDictionary. More...
|
|
| BDictionary (BDictionary< K, V > items, bool keepListChangingHandlers) |
|
void | Add (KeyValuePair< K, V > item) |
|
int | IndexOf (KeyValuePair< K, V > item) |
|
bool | Contains (KeyValuePair< K, V > item) |
|
bool | Remove (KeyValuePair< K, V > item) |
|
int | FindLowerBound (K key) |
| Finds the lowest index of an item with a key that is equal to or greater than the specified key. More...
|
|
int | FindLowerBound (K key, out bool found) |
|
int | FindLowerBound (ref K key) |
|
int | FindLowerBound (ref K key, out bool found) |
|
int | IndexOf (K key) |
|
int | FindUpperBound (K key) |
| Finds the index of the first item in the list that is greater than the specified item. More...
|
|
int | FindUpperBound (ref K key) |
|
void | AddRange (IEnumerable< KeyValuePair< K, V >> e) |
|
int | RemoveRange (IEnumerable< KeyValuePair< K, V >> e) |
|
int | RemoveRange (IEnumerable< K > e) |
|
void | Add (K key, V value) |
|
bool | ContainsKey (K key) |
|
bool | Remove (K key) |
|
bool | TryGetValue (K key, out V value) |
|
BDictionary< K, V > | Clone () |
|
BDictionary< K, V > | Clone (bool keepListChangingHandlers) |
| Clones a BDictionary. More...
|
|
BDictionary< K, V > | CopySection (int start, int subcount) |
|
BDictionary< K, V > | RemoveSection (int start, int count) |
|
bool | AddIfNotPresent (K key, V value) |
| Adds the specified pair only if the key is not already present in the dictionary. More...
|
|
bool | AddIfNotPresent (K key, ref V value) |
|
bool | AddIfNotPresent (ref K key, ref V value) |
|
bool | SetAndGetOldValue (K key, ref V value) |
| Associates the specified value with the specified key, while getting the old value if one exists. More...
|
|
bool | SetAndGetOldValue (ref K key, ref V value) |
|
bool | ReplaceIfPresent (K key, V value) |
| Replaces the value associated with a specified key, if it already exists in the dictionary. More...
|
|
bool | ReplaceIfPresent (K key, ref V value) |
|
bool | ReplaceIfPresent (ref K key, ref V value) |
|
void | RemoveAt (int index) |
|
void | RemoveRange (int index, int amount) |
|
int | RemoveAll (Predicate< T > match) |
| Removes all the elements that match the conditions defined by the specified predicate. More...
|
|
virtual void | Clear () |
|
IEnumerable< int > | IndexesOf (T item) |
| Returns a sequence of integers that represent the locations where a given item appears in the list. More...
|
|
virtual IEnumerable< int > | IndexesOf (T item, int minIndex, int maxIndex) |
|
int | LinearScanFor (T item, int startIndex, EqualityComparer< T > comparer) |
| Scans the list starting at startIndex and going upward, and returns the index of an item that matches the first argument. More...
|
|
void | CopyTo (T[] array, int arrayIndex) |
|
Enumerator | GetEnumerator () |
|
Enumerator | GetEnumerator (int startIndex) |
|
Enumerator | GetEnumerator (int start, int subcount) |
|
Enumerator | GetEnumerator (int start, int subcount, bool startAtEnd) |
|
T | TryGet (int index, out bool fail) |
| Gets the item at the specified index, and does not throw an exception on failure. More...
|
|
virtual void | Freeze () |
| Prevents further changes to the list. More...
|
|
Slice_< T > | Slice (int start, int length) |
| Returns a sub-range of this list. More...
|
|
int | GetImmutableCount () |
| Diagnostic method. Returns the number of elements of the list that are located in immutable nodes, which will be copied if modified. Used by the test suite. More...
|
|
virtual bool | AddObserver (IAListTreeObserver< K, T > observer) |
| Attaches a tree observer to this object. More...
|
|
virtual bool | RemoveObserver (IAListTreeObserver< K, T > observer) |
| Removes a previously attached tree observer from this list. More...
|
|
int | RemoveAll (Predicate< T > match) |
| Removes the all the elements that match the conditions defined by the specified predicate. More...
|
|
void | Clear () |
|
bool | Remove (T item) |
|
void | Add (T item) |
|
void | AddRange (IEnumerable< T > e) |
|
void | AddRange (IReadOnlyCollection< T > s) |
|
|
| BDictionary (BDictionary< K, V > original, AListNode< K, KeyValuePair< K, V >> section) |
|
override AListNode< K,
KeyValuePair< K, V > > | NewRootLeaf () |
|
override AListInnerBase< K,
KeyValuePair< K, V > > | SplitRoot (AListNode< K, KeyValuePair< K, V >> left, AListNode< K, KeyValuePair< K, V >> right) |
|
int | CompareToKey (KeyValuePair< K, V > item, K key) |
|
| AListBase (int maxLeafSize) |
|
| AListBase (int maxLeafSize, int maxInnerSize) |
|
| AListBase (AListBase< K, T > items, bool keepListChangingHandlers) |
| Cloning constructor. Does not duplicate the observer (IAListTreeObserver{K,T}), if any, because it may not be cloneable. More...
|
|
| AListBase (AListBase< K, T > original, AListNode< K, T > section) |
| This is the constructor that CopySection(), which can be defined by derived classes, should call to create a sublist of a list. Used in conjunction with CopySectionHelper(). More...
|
|
abstract AListInnerBase< K, T > | SplitRoot (AListNode< K, T > left, AListNode< K, T > right) |
|
virtual Enumerator | NewEnumerator (uint start, uint firstIndex, uint lastIndex) |
|
void | CheckPoint () |
|
void | AutoThrow () |
|
void | AutoCreateOrCloneRoot () |
|
void | AutoSplit (AListNode< K, T > splitLeft, AListNode< K, T > splitRight) |
|
void | HandleChangedOrUndersizedRoot (AListNode< K, T > result) |
|
virtual void | ClearInternal (bool forceClear) |
| Clears the tree. More...
|
|
AListNode< K, T > | CopySectionHelper (int start, int subcount) |
| Together with the AListBase{K,T}.AListBase(AListBase{K,T},AListNode{K,T}) constructor, this method helps implement the CopySection() method in derived classes, by cloning a section of the tree. More...
|
|
AListNode< K, T > | CopySectionHelper (uint start, uint subcount) |
|
void | SwapHelper (AListBase< K, T > other, bool swapObservers) |
| Swaps two ALists. More...
|
|