# -*- coding: utf-8 -*-"""The events which can be bound to envs."""fromabcimportABC,abstractmethodfromtypingimportAny,Tuple
[docs]classEvent:"""A class representing the information of an event. It contains the name of the event, the arguments of the event, and the returns of the event. """def__init__(self,name:str,args:dict=None,returns:Any=None,)->None:self._name=nameself._args=argsself._returns=returns@propertydefname(self)->str:"""Return the name of the event."""returnself._name@propertydefargs(self)->dict:"""Return the arguments of the event."""returnself._args@propertydefreturns(self)->Any:"""Return the returns of the event."""returnself._returns
[docs]classGetable(ABC):"""Representing an env whose value can be gotten."""
[docs]@abstractmethoddefget(self)->Any:"""Get the value of the env. Returns: `Any`: The value of the env. """
[docs]classSetable(ABC):"""Representing an env whose value can be set."""
[docs]@abstractmethoddefset(self,value:Any)->bool:"""Set the value of the env. Args: value (`Any`): The new value of the env. Returns: `bool`: Whether the value was set successfully. """
[docs]classMovable2D(ABC):"""A class representing an env can be moved in 2D."""
[docs]@abstractmethoddefmove_by(self,x:float,y:float)->bool:"""Move the env in 2D by the given vector. Args: x (`float`): The movement in x direction. y (`float`): The movement in y direction. Returns: `bool`: Whether the movement was successful. """
[docs]@abstractmethoddefmove_to(self,x:float,y:float)->bool:"""Move the env to the given position. Args: x (`float`): The x coordinate of the new position. y (`float`): The y coordinate of the new position. Returns: `bool`: Whether the movement was successful. """
[docs]@abstractmethoddefget_position(self)->Tuple[float,float]:"""Get the position of the env. Returns: `Tuple[float, float]`: The position of the env. """
[docs]classHoldable(ABC):"""A class representing an env can be held,and during the holding period, all access behaviors except the owner are prohibited. """
[docs]@abstractmethoddefacquire(self,owner:str)->bool:"""Acquire the env. Args: owner (`str`): The owner of the env. Returns: `bool`: Whether the env was acquired successfully. """
[docs]@abstractmethoddefrelease(self,owner:str)->bool:"""Release the env. Args: owner (`str`): The owner of the env. Returns: `bool`: Whether the env was released successfully. """