class · System
SortedDictionary<K, V>
public class System.SortedDictionary<K, V> : System.Any
A map from keys to values kept in key order: Set, Get, map[key], TryGet, ContainsKey, Remove, MinKey, MaxKey,
and loop (KeyValuePair<K, V> pair in map) from the smallest key.
- Kind
- class
- Namespace
- System
- Assembly
- System.Core
- Access
- public
- Source file
Sorted.ant
Type parameters
| Name | Constraints |
|---|---|
K | System.IComparable<K> |
V | any type |
Inheritance
- Base classes
-
AnySortedDictionary<K, V>
Constructors
constructor SortedDictionary()
#
Properties
Methods
method Set(key: K, value: V) -> void
#
Gives key the value value (adding it, or replacing its value).
method Add(key: K, value: V) -> void
#
Adds key; an ArgumentError when it is there already.
method Get(key: K) -> V
#
The value of key; a KeyNotFoundError when there is none.
method At(key: K) -> V
#
method SetAt(key: K, value: V) -> void
#
method TryGet(key: K, fallback: V) -> V
#
The value of key, or fallback when there is none.
Takes key out; false when it was not there.
method Clear() -> void
#
method MinKey() -> K
#
The smallest and largest keys (an InvalidOperationError when the map is empty).
method MaxKey() -> K
#
method Keys() -> System.List<K>
#
The keys and the values, in key order.
method Values() -> System.List<V>
#
method Iterator() -> System.SortedIterator<K, V>
#
Private and internal members (25)
field keys: K[]
#
field values: V[]
#
The next node never used; removed nodes are reused first (a list through left).
What the last insertion or removal did, and whether the heights above still need fixing (once a subtree keeps its height, nothing above it changes).
method Grow() -> void
#
The subtree at n with its heights fixed and, when one side grew two taller, rotated back into balance.
Puts key → value under n (replacing a value when replace); the subtree's new root.
Takes key out from under n; the subtree's new root.
n after a change below it: rebalanced while the change still moves heights (then nothing above moves).
static method Missing() -> void
#
static method Empty() -> void
#
Inherited members (5)
GetTypemethod from AnyUndescribedmethod from AnyToStringmethod from AnyHashmethod from Anydestroymethod from Any
Source
SortedDictionary<K, V> as Larva HIR, decompiled from its Larva HIR.
// A map from keys to values kept in key order: Set, Get, `map[key]`, TryGet, ContainsKey, Remove, MinKey, MaxKey,
// and `loop (KeyValuePair<K, V> pair in map)` from the smallest key.
public class System.SortedDictionary<K, V> : System.Any
{
field keys: K[]
field values: V[]
field left: i32[]
field right: i32[]
field height: i32[]
field root: i32
field count: i32
// The next node never used; removed nodes are reused first (a list through `left`).
field used: i32
field free: i32
// What the last insertion or removal did, and whether the heights above still need fixing (once a subtree keeps
// its height, nothing above it changes).
field changed: bool
field reshape: bool
method Grow() -> void
method Node(key: K, value: V) -> i32
method Release(n: i32) -> void
method Fix(n: i32) -> void
method RotateRight(n: i32) -> i32
method RotateLeft(n: i32) -> i32
// The subtree at n with its heights fixed and, when one side grew two taller, rotated back into balance.
method Balance(n: i32) -> i32
// Puts key → value under n (replacing a value when `replace`); the subtree's new root.
method Insert(n: i32, key: K, value: V, replace: bool) -> i32
// Takes key out from under n; the subtree's new root.
method Delete(n: i32, key: K) -> i32
// n after a change below it: rebalanced while the change still moves heights (then nothing above moves).
method Rebalanced(n: i32) -> i32
method DeleteSmallest(n: i32) -> i32
method Find(key: K) -> i32
static method Missing() -> void
static method Empty() -> void
constructor SortedDictionary()
// Gives `key` the value `value` (adding it, or replacing its value).
method Set(key: K, value: V) -> void
// Adds `key`; an ArgumentError when it is there already.
method Add(key: K, value: V) -> void
// The value of `key`; a KeyNotFoundError when there is none.
method Get(key: K) -> V
method At(key: K) -> V
method SetAt(key: K, value: V) -> void
// The value of `key`, or `fallback` when there is none.
method TryGet(key: K, fallback: V) -> V
method ContainsKey(key: K) -> bool
// Takes `key` out; false when it was not there.
method Remove(key: K) -> bool
method Clear() -> void
// The smallest and largest keys (an InvalidOperationError when the map is empty).
method MinKey() -> K
method MaxKey() -> K
// The keys and the values, in key order.
method Keys() -> System.List<K>
method Values() -> System.List<V>
method Iterator() -> System.SortedIterator<K, V>
method LeftOf(n: i32) -> i32
method RightOf(n: i32) -> i32
method KeyAt(n: i32) -> K
method ValueAt(n: i32) -> V
property Count: i32
property IsEmpty: bool
// The tree (for the iterator).
property Root: i32
}