event#

class besser.agent.core.transition.event.Event(name, session_id=None, timestamp=None)[source]#

Bases: ABC

The event abstract class.

An agent can receive events through its platforms. An agent can define transitions from one state to another based on the reception of specific events.

This class serves as a template to implement events.

Parameters:
  • name (str) – the event name

  • session_id (str or None) – the id of the session the event was sent to (can be none)

  • timestamp (datetime) – the timestamp indicating the event reception instant

_name#

the event name

Type:

str

_session_id#

the id of the session the event was sent to (can be none)

Type:

str or None

_timestamp#

the timestamp indicating the event reception instant

Type:

datetime

_abc_impl = <_abc._abc_data object>#
is_broadcasted()[source]#

Whether the event is broadcasted to all agent sessions or not (i.e., sent to a specific session)

Returns:

true if the event is broadcasted, false otherwise

Return type:

bool

is_matching(event)[source]#

Check whether an event matches another one.

This function can be overridden. Default behavior only checks if the event names are equal.

Parameters:

event (Event) – the target event to compare

Returns:

true if both events match, false otherwise

Return type:

bool

log()[source]#

Create a log message for the event.

This function can be overridden. Default message is the event name

Returns:

the log message

Return type:

str

property name#

The name of the event

Type:

str

property session_id#

The id of the session the event was sent to.

Type:

str or None

store_in_db()[source]#
property timestamp#

The timestamp indicating the event reception instant.

Type:

datetime