|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface IExternalAgent
The IExternalAgent is an interface for external agents implemented in Java loaded into the virtual machine to participate in a simulation or real-time agent environment. The external agent can perform any Java actions. It generally does not make much sense to implement this interface to build a Java agent implementation as this interface does not provide access to the world state or other agents. To build external agents it is recommended to extend the abstract class AbstractExternalAgent.
Method Summary | |
---|---|
void |
doWork()
The virtual machine takes care of having the agent run in its own thread of execution. |
IAgent |
getBrahmsAgent()
Returns the Brahms agent reference for this agent. |
void |
initialize()
Initialize is used to initialize the external agent after it has been loaded into the virtual machine. |
boolean |
isAcceptingFacts()
Indicates whether the agent wants to be notified of any fact related events (assertion/retraction). |
boolean |
isAutoReady()
Indicates whether the agent should automatically notify the scheduler it is ready for more events after it was notified of the current set of events and after onProcess was called. |
void |
notifyNewEvents()
Notifies the scheduler (only in simulation mode) that the external agent has new events ready for distribution. |
void |
onAssert(IFact fact)
onAssert is called by the virtual machine whenever a new fact is asserted in the world state. |
void |
onProcess(long time)
onProcess is called by the virtual machine when the virtual machine is in simulation mode and the agent is notified by the scheduler that it is allowed to process any events for the specified time. |
void |
onReceive(IBelief belief)
onReceive is called by the virtual machine whenever a new belief is communicated to the external agent by another agent or object. |
void |
onRetract(IFact fact)
onRetract is called by the virtual machine whenever a fact is retracted from the world state. |
void |
onThreadEnd()
onThreadEnd is the last method called just before the agent's thread is gracefully ending. |
void |
pause()
Pauses the external agent. |
void |
ready()
Notifies the scheduler that the agent completed its processing and is ready to receive more events. |
void |
reset()
Resets the external agent to the initialized state as it was placed in using the initialize method, performing any additional clean-up if necessary. |
void |
resume()
Resumes the external agent from a pause. |
void |
setBrahmsAgent(IAgent agent)
Sets the Brahms agent reference for this agent. |
void |
start()
Starts the external agent. |
void |
stop()
Stops the external agent. |
Method Detail |
---|
void setBrahmsAgent(IAgent agent)
agent
- the Brahms agent reference for this external agentIAgent getBrahmsAgent()
void initialize() throws ExternalException
ExternalException
- if an internal error occurs.void start() throws ExternalException
ExternalException
- if an internal error occurs.void pause() throws ExternalException
ExternalException
- if an internal error occurs.void resume() throws ExternalException
ExternalException
- if an internal error occurs.void stop() throws ExternalException
ExternalException
- if an internal error occurs.void reset() throws ExternalException
ExternalException
- if an internal error occurs.void doWork() throws ExternalException
ExternalException
- if an unrecoverable error occurs.void onProcess(long time) throws ExternalException
time
- the time for which agents can process their events.
ExternalException
- if an internal error occurs.boolean isAutoReady()
ready
method. The simulation will not proceed
until all agents notified the scheduler that they are
ready for the next set of events.
Note: Only relevant when the agent is used in simulation mode.
void ready()
isAutoReady
this method is a no-op, if
not isAutoReady
the agent must notify the
scheduler when it is ready to receive new events after
onProcess has been called. Only when ready is called
will the simulation proceed. The simulation waits after
onProcess is called for all agents until all agents are
ready to receive more events before the simulation
distributes the new events and advances time.
Note: Only relevant when the agent is used in simulation mode a no-op in real-time mode.
void notifyNewEvents()
void onReceive(IBelief belief) throws ExternalException
belief
- the IBelief communicated to this external agent
ExternalException
- if an error occurs handling this beliefboolean isAcceptingFacts()
void onAssert(IFact fact) throws ExternalException
fact
- the IFact asserted in the world state
ExternalException
- if an error occurs handling this factvoid onRetract(IFact fact) throws ExternalException
fact
- the IFact retracted from the world state
ExternalException
- if an error occurs handling this factvoid onThreadEnd() throws ExternalException
ExternalException
- if an error occurs during the cleanup
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |