Class RuntimeEzrObjectDictionary
- Namespace
- EzrSquared.Runtime.Collections
- Assembly
- ezrSquared-lib.dll
A Dictionary for IEzrObjects.
public class RuntimeEzrObjectDictionary : Dictionary<int, (IEzrObject Key, Reference ValueRef)>, IMutable<RuntimeEzrObjectDictionary>
- Inheritance
-
objectRuntimeEzrObjectDictionary
- Implements
Constructors
RuntimeEzrObjectDictionary()
Creates a new RuntimeEzrObjectDictionary.
public RuntimeEzrObjectDictionary()
RuntimeEzrObjectDictionary(IDictionary<int, (IEzrObject Key, Reference ValueRef)>)
public RuntimeEzrObjectDictionary(IDictionary<int, (IEzrObject Key, Reference ValueRef)> items)
Parameters
itemsIDictionary<int, (IEzrObject Key, Reference ValueRef)>An existing System.Collections.Generic.IDictionary<TKey, TValue> to create it from.
RuntimeEzrObjectDictionary(int)
public RuntimeEzrObjectDictionary(int capacity)
Parameters
capacityintThe capacity of the dictionary.
Properties
Count
The number of IEzrObjects in the RuntimeEzrObjectDictionary.
[WrapMember("length", false, false)]
public int Count { get; }
Property Value
- int
Methods
DeepCopy(RuntimeResult)
Creates a deep copy of the IMutable<T>.
public IMutable<RuntimeEzrObjectDictionary>? DeepCopy(RuntimeResult result)
Parameters
resultRuntimeResultRuntime result for raising errors./
Returns
- IMutable<RuntimeEzrObjectDictionary>
The copy, or, null if failed.
Remarks
The deep copy here means that all IMutable<T> properties and fields in the object are also copied.
~RuntimeEzrObjectDictionary()
Destructor.
protected ~RuntimeEzrObjectDictionary()
Get(IEzrObject, RuntimeResult)
Tries retrieving a value from the RuntimeEzrObjectDictionary.
public Reference Get(IEzrObject key, RuntimeResult result)
Parameters
keyIEzrObjectThe key of the value to be returned.
resultRuntimeResultThe RuntimeResult object for returning errors.
Returns
GetEnumerator()
public Dictionary<int, (IEzrObject Key, Reference ValueRef)>.Enumerator GetEnumerator()
Returns
- Dictionary<int, (IEzrObject Key, Reference ValueRef)>.Enumerator
Remarks
Unlike GetKeys(RuntimeResult) or GetPairs(RuntimeResult) this method does NOT copy the keys. So it's best not to expose the key values from this to the ezr² runtime as mutable key objects can be changed.
GetKeys(RuntimeResult)
Retrieves all keys from the RuntimeEzrObjectDictionary.
public IEzrObject[]? GetKeys(RuntimeResult result)
Parameters
resultRuntimeResultThe RuntimeResult object for returning errors.
Returns
- IEzrObject[]
The keys or null if something went wrong.
GetPairs(RuntimeResult)
Retrieves all keys and values from the RuntimeEzrObjectDictionary.
public KeyValuePair<IEzrObject, IEzrObject>[]? GetPairs(RuntimeResult result)
Parameters
resultRuntimeResultThe RuntimeResult object for returning errors.
Returns
- KeyValuePair<IEzrObject, IEzrObject>[]
The keys and values as an array of System.Collections.Generic.KeyValuePairs or null if something went wrong.
GetValues()
Retrieves all values from the RuntimeEzrObjectDictionary.
public IEzrObject[] GetValues()
Returns
- IEzrObject[]
The values.
HasKey(IEzrObject, RuntimeResult)
Checks if key exists in the RuntimeEzrObjectDictionary.
[WrapMember(false, false)]
public bool HasKey(IEzrObject key, RuntimeResult result)
Parameters
keyIEzrObjectThe key to be checked.
resultRuntimeResultThe RuntimeResult object for returning errors.
Returns
IsEqual(RuntimeEzrObjectDictionary, RuntimeResult)
Checks if the current dictionary is equal to the given dictionary.
public bool IsEqual(RuntimeEzrObjectDictionary other, RuntimeResult result)
Parameters
otherRuntimeEzrObjectDictionaryThe other dictionary.
resultRuntimeResultThe RuntimeResult object for returning errors.
Returns
- bool
The comparison result.
IsEqual(IEzrDictionary, Context, RuntimeResult)
Checks if the current dictionary is equal to the given keyed collection.
public bool IsEqual(IEzrDictionary other, Context executionContext, RuntimeResult result)
Parameters
otherIEzrDictionaryThe other keyed collection.
executionContextContextThe context under which this operation is being executed.
resultRuntimeResultThe RuntimeResult object for returning errors.
Returns
- bool
The comparison result.
Merge(RuntimeEzrObjectDictionary, RuntimeResult)
Merges a RuntimeEzrObjectDictionary to the current RuntimeEzrObjectDictionary.
public void Merge(RuntimeEzrObjectDictionary other, RuntimeResult result)
Parameters
otherRuntimeEzrObjectDictionaryThe other RuntimeEzrObjectDictionary to be merged.
resultRuntimeResultThe RuntimeResult object for returning errors.
Merge(IEzrDictionary, Context, RuntimeResult)
Merges an IEzrDictionary to the current RuntimeEzrObjectDictionary.
public void Merge(IEzrDictionary other, Context executionContext, RuntimeResult result)
Parameters
otherIEzrDictionaryThe other IEzrDictionary to be merged.
executionContextContextThe context under which this operation is being executed.
resultRuntimeResultThe RuntimeResult object for returning errors.
Release()
Releases the references associated with the dictionary, and clears it.
public void Release()
Remove(IEzrObject, RuntimeResult)
Removes a key, value pair from the RuntimeEzrObjectDictionary.
public bool Remove(IEzrObject key, RuntimeResult result)
Parameters
keyIEzrObjectThe key to be removed.
resultRuntimeResultThe RuntimeResult object for returning errors.
Returns
RemoveHash(int)
Removes a key, value pair from the RuntimeEzrObjectDictionary.
[WrapMember("remove_by_hash", false, false)]
public bool RemoveHash(int key)
Parameters
keyintThe key (hash) to be removed.
Returns
Remarks
This method removes pairs using the hash of the IEzrObject keys, key.
TryCopyObject(IEzrObject, RuntimeResult)
Tries to get a copy of the given object.
private static IEzrObject? TryCopyObject(IEzrObject ezrObject, RuntimeResult result)
Parameters
ezrObjectIEzrObjectThe object to copy.
resultRuntimeResultThe RuntimeResult object for returning errors.
Returns
- IEzrObject
The object, its copy or null if something went wrong.
Update(IEzrObject, IEzrObject, RuntimeResult)
Updates the RuntimeEzrObjectDictionary with a new value.
public void Update(IEzrObject key, IEzrObject value, RuntimeResult result)
Parameters
keyIEzrObjectThe key to update.
valueIEzrObjectThe value to assign to
key.resultRuntimeResultThe RuntimeResult object for returning errors.