Table of Contents

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
object
Dictionary<int, (IEzrObject Key, Reference ValueRef)>
RuntimeEzrObjectDictionary
Implements

Constructors

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 int

The 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 RuntimeResult

Runtime 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 IEzrObject

The key of the value to be returned.

result RuntimeResult

The RuntimeResult object for returning errors.

Returns

Reference

The retrieved value or Empty if it was not found.

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 RuntimeResult

The 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 RuntimeResult

The 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 IEzrObject

The key to be checked.

result RuntimeResult

The RuntimeResult object for returning errors.

Returns

bool

true if the key was found, false if any error occured or the key was not found.

IsEqual(RuntimeEzrObjectDictionary, RuntimeResult)

Checks if the current dictionary is equal to the given dictionary.

public bool IsEqual(RuntimeEzrObjectDictionary other, RuntimeResult result)

Parameters

other RuntimeEzrObjectDictionary

The other dictionary.

result RuntimeResult

The 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 IEzrDictionary

The other keyed collection.

executionContext Context

The context under which this operation is being executed.

result RuntimeResult

The RuntimeResult object for returning errors.

Returns

bool

The comparison result.

Merge(RuntimeEzrObjectDictionary, RuntimeResult)

public void Merge(RuntimeEzrObjectDictionary other, RuntimeResult result)

Parameters

other RuntimeEzrObjectDictionary

The other RuntimeEzrObjectDictionary to be merged.

result RuntimeResult

The 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 IEzrDictionary

The other IEzrDictionary to be merged.

executionContext Context

The context under which this operation is being executed.

result RuntimeResult

The 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 IEzrObject

The key to be removed.

result RuntimeResult

The RuntimeResult object for returning errors.

Returns

bool

true if the operation was successful, false if not.

RemoveHash(int)

Removes a key, value pair from the RuntimeEzrObjectDictionary.

[WrapMember("remove_by_hash", false, false)]
public bool RemoveHash(int key)

Parameters

key int

The key (hash) to be removed.

Returns

bool

true if the operation was successful, false if not.

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 IEzrObject

The object to copy.

result RuntimeResult

The 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 IEzrObject

The key to update.

value IEzrObject

The value to assign to key.

result RuntimeResult

The RuntimeResult object for returning errors.