Package jason.architecture
Class AgArch
java.lang.Object
jason.architecture.AgArch
- All Implemented Interfaces:
Serializable
,Comparable<AgArch>
- Direct Known Subclasses:
JasonBridgeArch
,LocalAgArch
,MindInspectorAgArch
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 Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
act
(ActionExec action) Executes the action action and, when finished, adds it back in feedback actions.void
actionExecuted
(ActionExec act) called to inform that the action execution is finishedvoid
Broadcasts a Jason messageboolean
canSleep()
Returns true if the agent can enter in sleep mode.void
Reads the agent's mailbox and adds messages into the agent's circumstanceint
void
createCustomArchs
(List<String> archs) boolean
Gets the agent's nameint
gets the current cycle numberReturns the first architecture in the chain of responsibility patternreturn agent specific run time services (e.g.getTS()
int
hashCode()
void
void
init()
void
insertAgArch
(AgArch arch) boolean
Checks whether the agent is runningperceive()
Gets the agent's perception as a list of Literals.void
A call-back method called by TS when a new reasoning cycle finishedvoid
A call-back method called by TS when a new reasoning cycle is startingvoid
Sends a Jason messagevoid
setCycleNumber
(int cycle) sets the number of the current cyclevoid
void
stop()
A call-back method called by the infrastructure tier when the agent is about to be killed.toString()
void
wake()
Puts the agent in sleep.void
void
void
-
Constructor Details
-
AgArch
public AgArch()
-
-
Method Details
-
init
- Throws:
Exception
-
stop
public void stop()A call-back method called by the infrastructure tier when the agent is about to be killed. -
getFirstAgArch
Returns the first architecture in the chain of responsibility pattern -
getNextAgArch
-
getAgArchClassesChain
-
insertAgArch
-
createCustomArchs
- 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
-
setTS
-
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
Executes the action action and, when finished, adds it back in feedback actions. -
actionExecuted
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
return agent specific run time services (e.g. jade agents implements its differently for each agent) -
getAgName
Gets the agent's name -
sendMsg
Sends a Jason message- Throws:
Exception
-
broadcast
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
-
hashCode
public int hashCode() -
equals
-
compareTo
- Specified by:
compareTo
in interfaceComparable<AgArch>
-
getStatus
-