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
items
IDictionary<int, (IEzrObject Key, Reference ValueRef)>An existing System.Collections.Generic.IDictionary<TKey, TValue> to create it from.
RuntimeEzrObjectDictionary(int)
public RuntimeEzrObjectDictionary(int capacity)
Parameters
capacity
intThe 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
result
RuntimeResultRuntime 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
key
IEzrObjectThe key of the value to be returned.
result
RuntimeResultThe 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
result
RuntimeResultThe 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
result
RuntimeResultThe 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
key
IEzrObjectThe key to be checked.
result
RuntimeResultThe 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
other
RuntimeEzrObjectDictionaryThe other dictionary.
result
RuntimeResultThe 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
other
IEzrDictionaryThe other keyed collection.
executionContext
ContextThe context under which this operation is being executed.
result
RuntimeResultThe 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
other
RuntimeEzrObjectDictionaryThe other RuntimeEzrObjectDictionary to be merged.
result
RuntimeResultThe 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
other
IEzrDictionaryThe other IEzrDictionary to be merged.
executionContext
ContextThe context under which this operation is being executed.
result
RuntimeResultThe 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
key
IEzrObjectThe key to be removed.
result
RuntimeResultThe 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
key
intThe 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
ezrObject
IEzrObjectThe object to copy.
result
RuntimeResultThe 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
key
IEzrObjectThe key to update.
value
IEzrObjectThe value to assign to
key
.result
RuntimeResultThe RuntimeResult object for returning errors.