Class AgArch

java.lang.Object
jason.architecture.AgArch
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<AgArch>
Direct Known Subclasses:
JasonBridgeArch, LocalAgArch, MindInspectorAgArch

public class AgArch
extends java.lang.Object
implements java.lang.Comparable<AgArch>, java.io.Serializable
Base agent architecture class that defines the overall agent architecture; the AS interpreter is the reasoner (a kind of mind) within this architecture (a kind of body).

The agent reasoning cycle (implemented in TransitionSystem class) calls these methods to get perception, action, and communication.

This class implements a Chain of Responsibilities design pattern. Each member of the chain is a subclass of AgArch. The last arch in the chain is the infrastructure tier (Local, JADE, Saci, ...). The getUserAgArch method returns the first arch in the chain. Users can customise the architecture by overriding some methods of this class.

See Also:
Serialized Form
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      See Also:
      Constant Field Values
    • ts

      private TransitionSystem ts
    • successor

      private AgArch successor
      Successor in the Chain of Responsibility
    • firstArch

      private AgArch firstArch
    • cycleNumber

      private int cycleNumber
      the current cycle number, in case of sync execution mode
  • Constructor Details

    • AgArch

      public AgArch()
  • Method Details

    • init

      public void init() throws java.lang.Exception
      Throws:
      java.lang.Exception
    • stop

      public void stop()
      A call-back method called by the infrastructure tier when the agent is about to be killed.
    • getFirstAgArch

      public AgArch getFirstAgArch()
      Returns the first architecture in the chain of responsibility pattern
    • getNextAgArch

      public AgArch getNextAgArch()
    • getAgArchClassesChain

      public java.util.List<java.lang.String> getAgArchClassesChain()
    • insertAgArch

      public void insertAgArch​(AgArch arch)
    • setFirstAgArch

      private void setFirstAgArch​(AgArch arch)
    • createCustomArchs

      public void createCustomArchs​(java.util.Collection<java.lang.String> archs) throws java.lang.Exception
      Throws:
      java.lang.Exception
    • reasoningCycleStarting

      public void reasoningCycleStarting()
      A call-back method called by TS when a new reasoning cycle is starting
    • reasoningCycleFinished

      public void reasoningCycleFinished()
      A call-back method called by TS when a new reasoning cycle finished
    • getTS

      public TransitionSystem getTS()
    • setTS

      public void setTS​(TransitionSystem ts)
    • perceive

      public java.util.Collection<Literal> perceive()
      Gets the agent's perception as a list of Literals. The returned list will be modified by Jason.
    • checkMail

      public void checkMail()
      Reads the agent's mailbox and adds messages into the agent's circumstance
    • act

      public void act​(ActionExec action)
      Executes the action action and, when finished, adds it back in feedback actions.
    • actionExecuted

      public void actionExecuted​(ActionExec act)
      called to inform that the action execution is finished
    • canSleep

      public boolean canSleep()
      Returns true if the agent can enter in sleep mode.
    • wake

      public void wake()
      Puts the agent in sleep.
    • wakeUpSense

      public void wakeUpSense()
    • wakeUpDeliberate

      public void wakeUpDeliberate()
    • wakeUpAct

      public void wakeUpAct()
    • getRuntimeServices

      @Deprecated public RuntimeServices getRuntimeServices()
      Deprecated.
      use RuntimeServicesFactory.get instead
    • getAgName

      public java.lang.String getAgName()
      Gets the agent's name
    • sendMsg

      public void sendMsg​(Message m) throws java.lang.Exception
      Sends a Jason message
      Throws:
      java.lang.Exception
    • broadcast

      public void broadcast​(Message m) throws java.lang.Exception
      Broadcasts a Jason message
      Throws:
      java.lang.Exception
    • isRunning

      public boolean isRunning()
      Checks whether the agent is running
    • setCycleNumber

      public void setCycleNumber​(int cycle)
      sets the number of the current cycle
    • incCycleNumber

      public void incCycleNumber()
    • getCycleNumber

      public int getCycleNumber()
      gets the current cycle number
    • toString

      public java.lang.String toString()
      Overrides:
      toString in class java.lang.Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class java.lang.Object
    • equals

      public boolean equals​(java.lang.Object obj)
      Overrides:
      equals in class java.lang.Object
    • compareTo

      public int compareTo​(AgArch o)
      Specified by:
      compareTo in interface java.lang.Comparable<AgArch>
    • getStatus

      public java.util.Map<java.lang.String,​java.lang.Object> getStatus()