Class AgArch

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

public class AgArch extends Object implements Comparable<AgArch>, 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:
  • Constructor Details

    • AgArch

      public AgArch()
  • Method Details

    • init

      public void init() throws Exception
      Throws:
      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 List<String> getAgArchClassesChain()
    • insertAgArch

      public void insertAgArch(AgArch arch)
    • createCustomArchs

      public void createCustomArchs(List<String> archs) throws Exception
      Throws:
      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 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

      public RuntimeServices getRuntimeServices()
      return agent specific run time services (e.g. jade agents implements its differently for each agent)
    • getAgName

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

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

      public void broadcast(Message m) throws Exception
      Broadcasts a Jason message
      Throws:
      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 String toString()
      Overrides:
      toString in class Object
    • hashCode

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

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • compareTo

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

      public Map<String,Object> getStatus()