usersimcrs.items.item

Represents an item.

Classes

Item

Creates an item.

Module Contents

class usersimcrs.items.item.Item(item_id: str, properties: Dict[str, Any] = None, domain: usersimcrs.core.simulation_domain.SimulationDomain = None)

Creates an item.

Each item has minimally an ID and can optionally have any number of properties, which are represented as key-value pairs.

Parameters:
  • item_id – Item ID.

  • properties – Dictionary of item properties (key-value pairs). Defaults to None.

  • domain – Domain of the item. Defaults to None.

property id: str

Return the item id.

property properties: Dict[str, Any]

Returns the item properties.

get_property(key: str) Any

Returns a given item property.

Parameters:

key – Name of property.

Returns:

Value of property or None.

set_property(key: str, value: Any) None

Sets the value of a given item property.

If the item property exists it will be overwritten.

Parameters:
  • key – Property name.

  • value – Property value.

Raises:

ValueError – if the property is not part of the domain knowledge.