jason.architecture
Class AgArch

Package class diagram package AgArch
java.lang.Object
  extended by jason.architecture.AgArch
All Implemented Interfaces:
AgArchInfraTier
Direct Known Subclasses:
CentralisedAgArch, JasonBridgeArch, MindInspectorAgArch

public class AgArch
extends java.lang.Object
implements AgArchInfraTier

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 (Centralised, JADE, Saci, ...). The getUserAgArch method returns the first arch in the chain. Users can customise the architecture by overriding some this class methods.


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
 void createCustomArchs(java.util.List<java.lang.String> archs)
           
 java.util.List<java.lang.String> getAgArchClassesChain()
           
 java.lang.String getAgName()
          Gets the agent's name
 AgArchInfraTier getArchInfraTier()
          returns the last arch in the chain, which is supposed to be the infra tier
 int getCycleNumber()
          gets the current cycle number in case of running in sync execution mode
 AgArch getFirstAgArch()
          Returns the first architecture in the chain of responsibility pattern
 AgArch getNextAgArch()
           
 RuntimeServicesInfraTier getRuntimeServices()
          Gets an object with infrastructure runtime services
 TransitionSystem getTS()
           
 void incCycleNumber()
           
 void init()
           
 void initAg(java.lang.String agClass, ClassParameters bbPars, java.lang.String asSrc, Settings stts)
          Deprecated. for arch initialisation you should override the init() method.
 void insertAgArch(AgArch arch)
           
 boolean isRunning()
          Checks whether the agent is running
 java.util.List<Literal> perceive()
          Gets the agent's perception as a list of Literals.
 void reasoningCycleStarting()
          A call-back method called by TS when a new reasoning cycle is starting
 void sendMsg(Message m)
          Sends a Jason message
 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 stop()
          A call-back method called by the infrastructure tier when the agent is about to be killed.
 void wake()
          Removes the agent from the "sleep" mode
 
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
Deprecated. for arch initialisation you should override the init() method.

Throws:
JasonException

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)

createCustomArchs

public void createCustomArchs(java.util.List<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


getArchInfraTier

public AgArchInfraTier getArchInfraTier()
returns the last arch in the chain, which is supposed to be the infra tier


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.

Specified by:
perceive in interface AgArchInfraTier

checkMail

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

Specified by:
checkMail in interface AgArchInfraTier

act

public void act(ActionExec action,
                java.util.List<ActionExec> feedback)
Executes the action action and, when finished, add it back in feedback actions.

Specified by:
act in interface AgArchInfraTier

canSleep

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

Specified by:
canSleep in interface AgArchInfraTier

sleep

public void sleep()
Puts the agent in sleep.

Specified by:
sleep in interface AgArchInfraTier

wake

public void wake()
Description copied from interface: AgArchInfraTier
Removes the agent from the "sleep" mode

Specified by:
wake in interface AgArchInfraTier

getRuntimeServices

public RuntimeServicesInfraTier getRuntimeServices()
Description copied from interface: AgArchInfraTier
Gets an object with infrastructure runtime services

Specified by:
getRuntimeServices in interface AgArchInfraTier

getAgName

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

Specified by:
getAgName in interface AgArchInfraTier

sendMsg

public void sendMsg(Message m)
             throws java.lang.Exception
Sends a Jason message

Specified by:
sendMsg in interface AgArchInfraTier
Throws:
java.lang.Exception

broadcast

public void broadcast(Message m)
               throws java.lang.Exception
Broadcasts a Jason message

Specified by:
broadcast in interface AgArchInfraTier
Throws:
java.lang.Exception

isRunning

public boolean isRunning()
Checks whether the agent is running

Specified by:
isRunning in interface AgArchInfraTier

setCycleNumber

public void setCycleNumber(int cycle)
sets the number of the current cycle in the sync execution mode


incCycleNumber

public void incCycleNumber()

getCycleNumber

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