madkit.kernel

## Enum AbstractAgent.ReturnCode

- java.lang.Object
- - java.lang.Enum<AbstractAgent.ReturnCode>
  - - madkit.kernel.AbstractAgent.ReturnCode

- All Implemented Interfaces:
    Serializable, Comparable<AbstractAgent.ReturnCode>
  Enclosing class:
    AbstractAgent

      public static enum AbstractAgent.ReturnCode
      extends Enum<AbstractAgent.ReturnCode>

  This class enumerates all the return codes which could be obtained with essential methods of the `AbstractAgent` and `Agent` classes.
  Since:
    MaDKit 5.0
  Author:
    Fabien Michel

- - ### Enum Constant Summary

    Enum Constants
    Enum Constant and Description
    `ACCESS_DENIED` Returned when requesting a role in a secured group fails
    `AGENT_CRASH` Returned by launch primitives when the launched agent crashes in activate
    `ALREADY_GROUP` Returned when using `AbstractAgent.createGroup(String, String, boolean, Gatekeeper)` and that a group already exists
    `ALREADY_KILLED` Returned by kill primitives when the targeted agent is already terminated
    `ALREADY_LAUNCHED` Returned when launching an agent which is already launched
    `CANT_REPLY` Returned when an agent tries to reply to a message which has not been received from another agent, e.g. newly created or sent directly by an object using `AbstractAgent.receiveMessage(Message)`.
    `IGNORED` Returned when `AbstractAgent.requestRole(String, String, String, Object)` or `AbstractAgent.createGroup(String, String, boolean, Gatekeeper)` is used in activate and that the agent has been launched using `AbstractAgent.launchAgentBucket(List, String...)` or `AbstractAgent.launchAgentBucket(String, int, String...)`
    `INVALID_AGENT_ADDRESS` Returned by send primitives when the targeted agent address does not exist anymore, i.e. the related agent has leaved the corresponding role
    `NO_RECIPIENT_FOUND` Returned by send primitives when the targeted CGR location does not exist or contain any agent
    `NOT_COMMUNITY` Indicates that a community does not exist
    `NOT_GROUP` Indicates that a group does not exist
    `NOT_IN_GROUP` Indicates that the agent is not in a group
    `NOT_ROLE` Indicates that a role does not exist
    `NOT_YET_LAUNCHED` Returned by kill primitives when the targeted agent has not been launched priorly
    `ROLE_ALREADY_HANDLED` Returned when the agent already has the requested role
    `ROLE_NOT_HANDLED` Returned when the agent does not have a role that it is supposed to have doing a particular action, e.g.
    `SEVERE` Returned on special errors.
    `SUCCESS`
    `TIMEOUT` Returned by various timed primitives of the Agent class like `Agent.sendMessageAndWaitForReply(AgentAddress, Message)` or `AbstractAgent.launchAgent(AbstractAgent, int, boolean)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `String` | `toString()`
    `static AbstractAgent.ReturnCode` | `valueOf(String name)` Returns the enum constant of this type with the specified name.
    `static AbstractAgent.ReturnCode[]` | `values()` Returns an array containing the constants of this enum type, in the order they are declared.

    - ### Methods inherited from class java.lang.Enum

      `clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf`

    - ### Methods inherited from class java.lang.Object

      `getClass, notify, notifyAll, wait, wait, wait`

- - ### Enum Constant Detail

    - #### SUCCESS

          public static final AbstractAgent.ReturnCode SUCCESS

    - #### NOT_COMMUNITY

          public static final AbstractAgent.ReturnCode NOT_COMMUNITY

      Indicates that a community does not exist

    - #### NOT_GROUP

          public static final AbstractAgent.ReturnCode NOT_GROUP

      Indicates that a group does not exist

    - #### NOT_ROLE

          public static final AbstractAgent.ReturnCode NOT_ROLE

      Indicates that a role does not exist

    - #### NOT_IN_GROUP

          public static final AbstractAgent.ReturnCode NOT_IN_GROUP

      Indicates that the agent is not in a group

    - #### ROLE_ALREADY_HANDLED

          public static final AbstractAgent.ReturnCode ROLE_ALREADY_HANDLED

      Returned when the agent already has the requested role

    - #### ACCESS_DENIED

          public static final AbstractAgent.ReturnCode ACCESS_DENIED

      Returned when requesting a role in a secured group fails

    - #### ROLE_NOT_HANDLED

          public static final AbstractAgent.ReturnCode ROLE_NOT_HANDLED

      Returned when the agent does not have a role that it is supposed to have doing a particular action, e.g. `AbstractAgent.sendMessageWithRole(AgentAddress, Message, String)`

    - #### ALREADY_GROUP

          public static final AbstractAgent.ReturnCode ALREADY_GROUP

      Returned when using `AbstractAgent.createGroup(String, String, boolean, Gatekeeper)` and that a group already exists

    - #### ALREADY_LAUNCHED

          public static final AbstractAgent.ReturnCode ALREADY_LAUNCHED

      Returned when launching an agent which is already launched

    - #### TIMEOUT

          public static final AbstractAgent.ReturnCode TIMEOUT

      Returned by various timed primitives of the Agent class like `Agent.sendMessageAndWaitForReply(AgentAddress, Message)` or `AbstractAgent.launchAgent(AbstractAgent, int, boolean)`

    - #### AGENT_CRASH

          public static final AbstractAgent.ReturnCode AGENT_CRASH

      Returned by launch primitives when the launched agent crashes in activate

    - #### NOT_YET_LAUNCHED

          public static final AbstractAgent.ReturnCode NOT_YET_LAUNCHED

      Returned by kill primitives when the targeted agent has not been launched priorly

    - #### ALREADY_KILLED

          public static final AbstractAgent.ReturnCode ALREADY_KILLED

      Returned by kill primitives when the targeted agent is already terminated

    - #### INVALID_AGENT_ADDRESS

          public static final AbstractAgent.ReturnCode INVALID_AGENT_ADDRESS

      Returned by send primitives when the targeted agent address does not exist anymore, i.e. the related agent has leaved the corresponding role

    - #### NO_RECIPIENT_FOUND

          public static final AbstractAgent.ReturnCode NO_RECIPIENT_FOUND

      Returned by send primitives when the targeted CGR location does not exist or contain any agent

    - #### IGNORED

          public static final AbstractAgent.ReturnCode IGNORED

      Returned when `AbstractAgent.requestRole(String, String, String, Object)` or `AbstractAgent.createGroup(String, String, boolean, Gatekeeper)` is used in activate and that the agent has been launched using `AbstractAgent.launchAgentBucket(List, String...)` or `AbstractAgent.launchAgentBucket(String, int, String...)`

- #### CANT_REPLY

      public static final AbstractAgent.ReturnCode CANT_REPLY

  Returned when an agent tries to reply to a message which has not been received from another agent, e.g. newly created or sent directly by an object using `AbstractAgent.receiveMessage(Message)`.

- #### SEVERE

      public static final AbstractAgent.ReturnCode SEVERE

  Returned on special errors. This should not be encountered

- ### Method Detail

  - #### values

        public static AbstractAgent.ReturnCode[] values()

    Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:

        for (AbstractAgent.ReturnCode c : AbstractAgent.ReturnCode.values())
            System.out.println(c);

    Returns:
      an array containing the constants of this enum type, in the order they are declared

  - #### valueOf

        public static AbstractAgent.ReturnCode valueOf(String name)

    Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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 type has no constant with the specified name
      `NullPointerException` - if the argument is null

  - #### toString

        public String toString()

    Overrides:
      `toString` in class `Enum<AbstractAgent.ReturnCode>`

Fabien Michel, Olivier Gutknecht, Jacques Ferber - February 17 2020