jason.architecture
Class AgArch

Package class diagram package AgArch
java.lang.Object
  extended by jason.architecture.AgArch

public class AgArch
extends java.lang.Object

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 normally just calls the AgArchInfraTier methods implemented by the infrastructure tier (Centralised, JADE, Saci, ...). However, the user can customise these methods overriding some of them in his/her arch. class.


Constructor Summary
AgArch()
           
 
Method Summary
 void act(ActionExec action, java.util.List<ActionExec> feedback)
          Executes the action action and, when finished, add it back in feedback actions.
 void broadcast(Message m)
          Broadcasts a Jason message
 boolean canSleep()
          Returns true if the agent can enter in sleep mode.
 void checkMail()
          Reads the agent's mailbox and adds messages into the agent's circumstance
 java.lang.String getAgName()
          Gets the agent's name
 AgArchInfraTier getArchInfraTier()
           
 int getCycleNumber()
          gets the current cycle number in case of running in sync execution mode
 TransitionSystem getTS()
           
 void initAg(java.lang.String agClass, ClassParameters bbPars, java.lang.String asSrc, Settings stts)
          Creates the agent class defined by agClass, default is jason.asSemantics.Agent.
 boolean isRunning()
          Checks whether the agent is running
 java.util.List<Literal> perceive()
          Gets the agent's perception as a list of Literals.
 void sendMsg(Message m)
          Sends a Jason message
 void setArchInfraTier(AgArchInfraTier ai)
           
 void setCycleNumber(int cycle)
          sets the number of the current cycle in the sync execution mode
 void setTS(TransitionSystem ts)
           
 void sleep()
          Puts the agent in sleep.
 void stopAg()
          A call-back method called by the infrastructure tier when the agent is about to be killed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AgArch

public AgArch()
Method Detail

initAg

public void initAg(java.lang.String agClass,
                   ClassParameters bbPars,
                   java.lang.String asSrc,
                   Settings stts)
            throws JasonException
Creates the agent class defined by agClass, default is jason.asSemantics.Agent. The agent class will parse the source code, create the transition system (TS), ...

Throws:
JasonException

stopAg

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


setArchInfraTier

public void setArchInfraTier(AgArchInfraTier ai)

getArchInfraTier

public AgArchInfraTier getArchInfraTier()

getTS

public TransitionSystem getTS()

setTS

public void setTS(TransitionSystem ts)

perceive

public java.util.List<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,
                java.util.List<ActionExec> feedback)
Executes the action action and, when finished, add it back in feedback actions.


canSleep

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


sleep

public void sleep()
Puts the agent in sleep.


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 in the sync execution mode


getCycleNumber

public int getCycleNumber()
gets the current cycle number in case of running in sync execution mode