Enum Class AgentAction

java.lang.Object
java.lang.Enum<AgentAction>
madkit.action.AgentAction
All Implemented Interfaces:
Serializable, Comparable<AgentAction>, Constable

public enum AgentAction extends Enum<AgentAction>
This enumeration contains common agent actions that they can perform.

It is designed to ease the creation of GUIs for agents by providing a way to create Actions for common agent actions.

Example usage:

 
 AgentAction action = AgentAction.LAUNCH_AGENT;
 Action fxAction = action.newActionFor(agent, parameters);
 
 
Since:
MaDKit 5.0.0.14
See Also:
  • Enum Constant Details

    • LAUNCH_AGENT

      public static final AgentAction LAUNCH_AGENT
      Action to launch an agent.
    • RELOAD

      public static final AgentAction RELOAD
      Action to reload an agent.
    • CREATE_GROUP

      public static final AgentAction CREATE_GROUP
      Action to create a group.
    • REQUEST_ROLE

      public static final AgentAction REQUEST_ROLE
      Action to request a role.
    • LEAVE_ROLE

      public static final AgentAction LEAVE_ROLE
      Action to leave a role.
    • LEAVE_GROUP

      public static final AgentAction LEAVE_GROUP
      Action to leave a group.
    • SEND_MESSAGE

      public static final AgentAction SEND_MESSAGE
      Action to send a message.
    • BROADCAST_MESSAGE

      public static final AgentAction BROADCAST_MESSAGE
      Action to broadcast a message.
    • KILL_AGENT

      public static final AgentAction KILL_AGENT
      Action to kill an agent.
  • Method Details

    • values

      public static AgentAction[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static AgentAction valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • getActionFor

      public Action getActionFor(Agent agent, Object... parameters)
      Builds an FX action that will make the agent perform the corresponding operation if possible.
      Parameters:
      agent - the agent that will send the message to the kernel
      parameters - the parameters for the action
      Returns:
      the new corresponding action
    • createAgentFxActionGroup

      public static ActionGroup createAgentFxActionGroup(Agent agent)
      Creates an action group for the given agent. The action group includes actions for reloading, launching, and killing the agent.
      Parameters:
      agent - the agent for which to create the action group
      Returns:
      an ActionGroup containing the actions for the agent