Table of Contents

Interface IMergable

Namespace
Gym.Merging
Assembly
Gym.dll

A string-keyed container the legacy deep merge (Merger) can read and write key by key: the legacy Dict is the one implementation. IsExpandable decides whether a merge may add keys or only overwrite existing ones.

[Obsolete("The legacy Dict's deep merge: use Gym.Envs.Info.Update (Python's dict.update: the new value wins, one level deep). Removed in 2.0 with Gym.Legacy.")]
public interface IMergable
Extension Methods

Remarks

Obsolete with Dict (DR-56) and removed in 2.0; Info is the 2.0 dictionary, merged with Update(IEnumerable<KeyValuePair<string, object?>>).

Properties

Contents

The key-value pairs, in the implementation's order; the merge does not read it.

IEnumerable<KeyValuePair<string, object>> Contents { get; }

Property Value

IEnumerable<KeyValuePair<string, object>>

Count

The number of keys; a merge from an IMergable with none returns at once.

int Count { get; }

Property Value

int

IsExpandable

Is it possible to add values of keys that do not present in Keys?

bool IsExpandable { get; }

Property Value

bool

Keys

All current keys of this object.

IEnumerable<string> Keys { get; }

Property Value

IEnumerable<string>

Methods

Get(string)

Gets the value of key.

object Get(string key)

Parameters

key string

The key to read.

Returns

object

The value stored under key.

Exceptions

KeyNotFoundException

When key is not present (the legacy Dict indexes directly).

Merge(object, MergePrefer)

Performs a merge with object of unknown type: a dictionary, another IMergable, or a sequence of string-keyed pairs. Anything else merges nothing, silently.

void Merge(object right, MergePrefer preference)

Parameters

right object

object to take data from

preference MergePrefer

see the documentation on the enum values.

Set(string, object)

Assign value to given key.

void Set(string key, object value)

Parameters

key string

The key to set.

value object

The value, stored as given (not copied).

Exceptions

KeyNotFoundException

If IsExpandable is false and When the key is not present