|
JACK 5.4 Application Interface | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectaos.jack.jak.scheduler.Executee
aos.jack.jak.agent.Agent
The Agent class is the primary base class for JACK agents. It provides the core implementation for dealing with events, messages, and tasks.
Field Summary | |
ThreadPool |
thread_pool
The default thread pool for this agent. |
Timer |
timer
The default timer for this agent. |
Constructor Summary | |
Agent(java.lang.String n)
Constructs an agent with a given name. |
Method Summary | |
protected void |
__init1()
Support for agent constructor methods. |
protected void |
__init2()
Support for agent constructor methods. |
protected void |
addToDo(aos.jack.jak.agent.ToDo tdo)
|
aos.jack.jak.agent.WaitFor |
addWaitFor(aos.jack.jak.agent.WaitForClient inform,
aos.jack.jak.core.Generator g,
Cursor c,
boolean b)
|
aos.jack.jak.agent.WaitFor |
addWaitFor(aos.jack.jak.agent.WaitForClient inform,
aos.jack.jak.core.Generator g,
int ind,
boolean b)
|
void |
bug(java.lang.String n)
Prints a string with agent identification. |
void |
changeFocus()
Forces a context switch away from this agent. |
static void |
describeAllAgents(java.io.PrintStream out)
Dump the current state of each agent to the given PrintStream . |
java.lang.String |
describeState()
Dumps a text description of the current state of the agent. |
void |
discardAllTasks()
This will discard the all the agent's tasks. |
void |
discardOtherTasks()
This will discard all the agent's tasks except the one currently running. |
void |
discardReplies(MessageEvent e)
Discards any pending replies for the given message event. |
void |
dump()
Dumps a verbose text description of the agent's state to System.err . |
void |
dump(java.io.PrintStream out)
Dumps a verbose text description of the agent's state to the given java.io.PrintStream . |
void |
dump(java.io.PrintWriter w)
Dumps a verbose text description of the agent's state to a PrintWriter. |
void |
dumpPlans(java.io.PrintWriter pw)
Dumps a text description of all plans available in the agent and the events they handle. |
java.lang.String |
dumpToString()
Returns a verbose text description of the agent's state. |
static Agent |
findLocalAgent(java.lang.String name)
Looks up a named agent at the local portal. |
void |
finish()
Upon calling this method, the agent's plan processing will stop after the next plan step and the agent will no longer receive messages. |
Agent |
getAgent()
Returns this agent instance. |
java.lang.String |
getBasename()
Returns the basename of the agent, which is the local name given on construction. |
static Agent |
getCurrentAgent()
Get the agent that is currently executing in the current thread. |
aos.jack.jak.task.Task |
getCurrentTask()
Return the Task currently being executed by the agent. |
Event[] |
getKnownEvents()
Returns an array of known Events loaded in the agent. |
Plan[] |
getKnownPlans()
Returns an array of known plans loaded in the agent. |
java.lang.String |
getName()
Returns the full name of the agent, which consists of both the local name supplied on construction and the name of the portal on which it was created, separated by an "@" character. |
java.util.Observable |
getObservable()
Returns an Observable which will be notified when any change occurs in the agent. |
MessageEvent |
getReply(MessageEvent e)
Gets the first pending reply for the specified message. |
TaskManager |
getTaskManager()
Return the current TaskManager (tasks). |
AgentInfo |
getTraceableInfo(TraceableBase b)
|
static boolean |
inAgent()
A method to determine if some Java code is executing within the context of an agent. |
void |
initialize(InitialData data)
A convenience hook for agent initialisation. |
boolean |
isBlocked(aos.jack.jak.task.Task in)
Determines if the given task is blocked (in this agent). |
boolean |
isIdle()
Determines if the agent has nothing to do -- no messages or events to process and no runnable tasks. |
java.lang.String |
name()
Deprecated. |
int |
nEvents()
Returns the number of pending events. |
int |
nMessages()
Returns the number of pending messages. |
int |
nTasks()
Returns the number of active tasks. |
int |
nTodo()
Returns the number of things in the agent's "todo" list. |
void |
postEvent(Event e)
This method is used to tell the agent to handle a new event. |
boolean |
postEventAndWait(Event e)
This method is used to tell the agent to handle a new event. |
void |
process()
|
protected void |
processEvent(Event ev)
|
protected void |
processMessage(Message cur)
|
protected void |
processTask(aos.jack.jak.task.Task tsk)
|
protected void |
processToDo(aos.jack.jak.agent.ToDo cur)
|
Cursor |
replied(MessageEvent e)
Returns a cursor which will be triggered and return true when a reply to the message is available. |
void |
reply(MessageEvent r,
MessageEvent e)
Sends a reply message (e) to a received message (r). |
void |
restartIfIdle()
Forces the agent to unblock from an IDLE state. |
protected void |
rmToDo(aos.jack.jak.agent.ToDo tdo)
|
void |
rmWaitFor(aos.jack.jak.agent.WaitFor o)
|
void |
send(java.lang.String to,
Message e)
Sends a Message to the named agent. |
void |
send(java.lang.String to,
MessageEvent e)
Sends a MessageEvent to the named agent. |
protected void |
startAgent()
Starts the agent's event processing. |
java.lang.String |
toString()
Returns the name of the agent class together with the ful agent name. |
void |
trigger(java.lang.Object o,
int n)
|
void |
warning(java.lang.String n)
Prints a string with agent identification. |
Methods inherited from class aos.jack.jak.scheduler.Executee |
isPaused, remove, run, stop |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public Timer timer
RTClock.timer
public ThreadPool thread_pool
Constructor Detail |
public Agent(java.lang.String n)
Method Detail |
public int nEvents()
public int nMessages()
public int nTasks()
public int nTodo()
public TaskManager getTaskManager()
public java.lang.String getName()
getName
in class Executee
public java.lang.String name()
name
in class Executee
public java.lang.String getBasename()
public static Agent findLocalAgent(java.lang.String name)
protected void startAgent()
public void warning(java.lang.String n)
public void bug(java.lang.String n)
public void finish()
protected void __init1()
protected void __init2()
public void changeFocus()
public void restartIfIdle()
public boolean isBlocked(aos.jack.jak.task.Task in)
protected void addToDo(aos.jack.jak.agent.ToDo tdo)
protected void rmToDo(aos.jack.jak.agent.ToDo tdo)
public Cursor replied(MessageEvent e)
FalseCursor()
if the message has not been sent.
public MessageEvent getReply(MessageEvent e)
null
if the message has not been sent or if there are no
pending replies.
public void discardReplies(MessageEvent e)
protected void processToDo(aos.jack.jak.agent.ToDo cur)
protected void processMessage(Message cur)
protected void processEvent(Event ev)
protected void processTask(aos.jack.jak.task.Task tsk)
public boolean isIdle()
finish()
has been called on the agent.
public void process()
public static boolean inAgent()
getCurrentAgent()
.
public aos.jack.jak.task.Task getCurrentTask()
public static Agent getCurrentAgent()
null
if there isn't one executing
in the current thread when the call is made.
public boolean postEventAndWait(Event e)
public void postEvent(Event e)
public aos.jack.jak.agent.WaitFor addWaitFor(aos.jack.jak.agent.WaitForClient inform, aos.jack.jak.core.Generator g, int ind, boolean b)
public aos.jack.jak.agent.WaitFor addWaitFor(aos.jack.jak.agent.WaitForClient inform, aos.jack.jak.core.Generator g, Cursor c, boolean b)
public void rmWaitFor(aos.jack.jak.agent.WaitFor o)
public void reply(MessageEvent r, MessageEvent e)
public void send(java.lang.String to, MessageEvent e)
public void send(java.lang.String to, Message e)
public Agent getAgent()
public void discardAllTasks()
public void discardOtherTasks()
public static void describeAllAgents(java.io.PrintStream out)
PrintStream
.
public void initialize(InitialData data)
public java.lang.String toString()
public java.lang.String dumpToString()
public void dump()
System.err
.
public void dump(java.io.PrintStream out)
java.io.PrintStream
.
public void dump(java.io.PrintWriter w)
public Plan[] getKnownPlans()
public Event[] getKnownEvents()
public java.util.Observable getObservable()
public void trigger(java.lang.Object o, int n)
public AgentInfo getTraceableInfo(TraceableBase b)
public void dumpPlans(java.io.PrintWriter pw)
public java.lang.String describeState()
describeState
in class Executee
|
JACK 5.4 Application Interface | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
US Government Restricted Rights
The JACK Modules and relevant Software Material have been developed entirely at private expense and are accordingly provided with RESTRICTED RIGHTS. Use, duplication, or disclosure by Government is subject to restrictions as set forth in subparagraph (c)(1)(ii) of DFARS 252.227-7013 or subparagraph (c)(1) and (2) of the Commercial Computer Software Restricted Rights and 48 CFR 52.2270-19, as applicable.