concepts.dsl.tensor_state.NamedObjectStateMixin#
- class NamedObjectStateMixin[source]#
Bases:
object
A state type mixin with named objects.
Methods
get_nr_objects_by_type
(typename)Get the number of objects with the given type.
get_typed_index
(name[, typename])Get the typed index of the object with the given name.
get_typename
(name)Get the typename of the object with the given name.
Attributes
The number of objects in the current state.
- __init__(object_names, object_types=None)[source]#
A state type mixin with named objects. The object names can be either a list of names, or a mapping from names to
ObjectType
’s.If the object_names is a list of names, then the user should also specify a list of object types.
If the object_names is a mapping from names to
ObjectType
’s, then the object_types argument should be None.
- Parameters:
object_names (Iterable[str] | Mapping[str, ObjectType]) – the object names.
object_types (Iterable[ObjectType] | None) – the object types.
- __new__(**kwargs)#
- get_typed_index(name, typename=None)[source]#
Get the typed index of the object with the given name. There is an additional typename argument to specify the type of the object. Because the same object can have multiple types (due to inheritence), the object can have multiple typed indices, one for each type. When the typename is not specified, the default type of the object is used (i.e., the most specific type).