pymasep.common.intention ======================== .. py:module:: pymasep.common.intention Classes ------- .. autoapisummary:: pymasep.common.intention.Intention Module Contents --------------- .. py:class:: Intention(environment, name = None, parent=None, xml_node = None, template=None, src_copy = None) Bases: :py:obj:`pymasep.common.base_object.BaseObject` An intention is a desired action. This class stores all intentions of an agent The intention is attached to the agent when it has been validated by the game rules. :param environment: the environment :param name: name of the BaseObject :param xml_node: XML used to create the object. :param template: Template of the base object. Needed if no xml_node. :param parent: Parent object (see objects hierarchy) :param src_copy: The Intention to copy. Needed if no xml_node or template. The copy is not made into the constructor. :raise pymasep.common.exception.CreationException: If no XML or no template or src_copy is present .. py:attribute:: name :type: str :value: 'intention' the name of the object intention .. py:attribute:: intentions :value: [] list of intentions. The order reflects the desired order of the agent .. py:attribute:: state :type: str :value: 'run' State of the BaseObject. None if the object is just created. "Init" if it misses something (input from user) to finish the creation. "Run" is the BaseObject is operational. :return: The state of the BaseObject .. py:method:: add_intention(intention) add an intention to the agent intentions list :param intention: the intention (an action) to add .. py:method:: id_str() Create an str unique ID of the Intention. :return: the string unique ID .. py:method:: to_xml() Transform the Intention to XML. See :ref:`serialization` for more information. :return: XML version of the Intention .. py:method:: from_xml(environment, xml_node) Transform an XML to an Intention. The instance must be created before (with __init__(), passing the xml_node). See :ref:`serialization` for more information. :param environment: The environment where the BaseObject is created. :param xml_node: The XML node that contains the intention data. .. py:method:: copy_obs(params) Deep copy the Intention to a new instance. :param params: Not used in this method. Note : this method copy the reference of the parent. The parent should do the parent copy and assignment