public class AgArch extends java.lang.Object implements AgArchInfraTier, java.lang.Comparable<AgArch>
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 methods of this class.
Modifier and Type | Field and Description |
---|---|
private int |
cycleNumber
the current cycle number, in case of sync execution mode
|
private AgArch |
firstArch |
private AgArch |
successor
Successor in the Chain of Responsibility
|
private TransitionSystem |
ts |
Constructor and Description |
---|
AgArch() |
Modifier and Type | Method and Description |
---|---|
void |
act(ActionExec action)
Executes the action action and, when finished, add it back in
feedback actions.
|
void |
actionExecuted(ActionExec act)
called to inform that the action execution is finished
|
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
|
int |
compareTo(AgArch o) |
void |
createCustomArchs(java.util.List<java.lang.String> archs) |
boolean |
equals(java.lang.Object obj) |
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
|
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() |
int |
hashCode() |
void |
incCycleNumber() |
void |
init() |
void |
insertAgArch(AgArch arch) |
boolean |
isRunning()
Checks whether the agent is running
|
java.util.Collection<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
|
private void |
setFirstAgArch(AgArch arch) |
void |
setTS(TransitionSystem ts) |
void |
stop()
A call-back method called by the infrastructure tier
when the agent is about to be killed.
|
java.lang.String |
toString() |
void |
wake()
Puts the agent in sleep.
|
void |
wakeUpAct() |
void |
wakeUpDeliberate() |
void |
wakeUpSense() |
private TransitionSystem ts
private AgArch successor
private AgArch firstArch
private int cycleNumber
public void init() throws java.lang.Exception
java.lang.Exception
public void stop()
public AgArch getFirstAgArch()
public AgArch getNextAgArch()
public java.util.List<java.lang.String> getAgArchClassesChain()
public void insertAgArch(AgArch arch)
private void setFirstAgArch(AgArch arch)
public void createCustomArchs(java.util.List<java.lang.String> archs) throws java.lang.Exception
java.lang.Exception
public void reasoningCycleStarting()
public AgArchInfraTier getArchInfraTier()
public TransitionSystem getTS()
public void setTS(TransitionSystem ts)
public java.util.Collection<Literal> perceive()
perceive
in interface AgArchInfraTier
public void checkMail()
checkMail
in interface AgArchInfraTier
public void act(ActionExec action)
act
in interface AgArchInfraTier
public void actionExecuted(ActionExec act)
public boolean canSleep()
canSleep
in interface AgArchInfraTier
public void wake()
wake
in interface AgArchInfraTier
public void wakeUpSense()
public void wakeUpDeliberate()
public void wakeUpAct()
public RuntimeServicesInfraTier getRuntimeServices()
AgArchInfraTier
getRuntimeServices
in interface AgArchInfraTier
public java.lang.String getAgName()
getAgName
in interface AgArchInfraTier
public void sendMsg(Message m) throws java.lang.Exception
sendMsg
in interface AgArchInfraTier
java.lang.Exception
public void broadcast(Message m) throws java.lang.Exception
broadcast
in interface AgArchInfraTier
java.lang.Exception
public boolean isRunning()
isRunning
in interface AgArchInfraTier
public void setCycleNumber(int cycle)
public void incCycleNumber()
public int getCycleNumber()
public java.lang.String toString()
toString
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object