|
The Meta-Environment API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecttoolbus.tool.ToolInstance
public class ToolInstance
Provides the interface to a tool instance.
Field Summary | |
---|---|
private static int |
BLOCKED
|
private static int |
DISCONNECTED
|
private java.util.List<aterm.ATerm> |
eventsFromTool
|
private IIOHandler |
ioHandler
|
private static int |
KILLED
|
private aterm.ATerm |
lastDebugPerformanceStats
|
private java.util.List<aterm.ATerm> |
performanceStats
|
private static int |
READY
|
private java.util.List<aterm.ATerm> |
requestsFromTool
|
private int |
state
|
private java.lang.Object |
stateLock
|
private StreamHandler |
streamHandler
|
private TBTermFactory |
tbfactory
|
private static int |
TERMINATED
|
private ToolBus |
toolbus
|
private ToolDefinition |
toolDef
|
private int |
toolID
|
private aterm.ATermAppl |
toolKey
|
private static int |
toolNr
|
private static int |
UNCONNECTED
|
private static int |
UNREACHABLE
|
private java.util.List<aterm.ATerm> |
valuesFromTool
|
Fields inherited from interface toolbus.IOperations |
---|
ACKDO, ACKEVENT, CONNECT, DEBUGPERFORMANCESTATS, DISCONNECT, DO, END, EVAL, EVENT, PERFORMANCESTATS, REQUEST, RESPONSE, TERMINATE, UNDEFINED, VALUE |
Constructor Summary | |
---|---|
ToolInstance(ToolDefinition toolDef,
ToolBus toolbus)
Constructor. |
Method Summary | |
---|---|
void |
exceptionOccured()
Notifies the data handler that an exception has occured so it can take the necessary steps. |
void |
executeTool()
Executes the tool that should be associated with this tool instance. |
boolean |
getEventFromTool(aterm.ATerm pattern,
Environment env)
Attempts to find a event that matches the given signature. |
aterm.ATerm |
getLastDebugPerformanceStats()
Returns the last received batch of debug performance statistics. |
boolean |
getPerformanceStats(aterm.ATerm aTerm,
Environment env)
Attempts to find performance statistics that match the given signature. |
aterm.ATerm[] |
getQueuedEvents()
Returns an array of all queued rec-event terms for this tool instance. |
aterm.ATerm[] |
getQueuedRequests()
Returns an array of all queued rec-request terms for this tool instance. |
aterm.ATerm[] |
getQueuedValues()
Returns an array of all queued rec-value terms for this tool instance. |
boolean |
getRequestFromTool(aterm.ATerm pattern,
Environment env)
Attempts to find a request that matches the given signature. |
int |
getToolID()
Returns the id of the tool that is associated with this tool instance. |
aterm.ATermAppl |
getToolKey()
Returns the key of the tool that is associated with this tool instance. |
java.lang.String |
getToolName()
Returns the name of the tool that is associated with this tool instance. |
boolean |
getValueFromTool(aterm.ATerm pattern,
Environment env)
Attempts to find a value that matches the given signature. |
private void |
goConnected()
Notifies this tool instance that the tool connected. |
private void |
goDisconnected()
Notifies this tool instance that the tool has disconnected. |
private void |
goKilled()
Notifies this tool instance that the tool has been killed. |
void |
goReady()
Notifies this tool instance that the tool is ready to receive a new DO or EVAL request. |
private void |
goTerminated()
Notifies this tool instance that the tool has terminated. |
private void |
goUnreachable()
Notifies this tool instance that the tool has become unreachable. |
boolean |
isConnected()
Checks if the tool is connected. |
boolean |
isDisconnected()
Checks if the tool has disconnected. |
boolean |
isExecutedTool()
Checks if the tool that is associated with this tool instance was executed or connected on it's own initiative. |
boolean |
isKilled()
Checks if the tool has been killed. |
boolean |
isReady()
Checks if the tool is ready. |
boolean |
isTerminated()
Checks if the tool has been terminated. |
boolean |
isUnreachable()
Checks if the tool has become unreachable. |
void |
kill()
Forcefully terminates the with this tool instance associated tool. |
void |
receive(byte operation,
aterm.ATerm aTerm)
Receives a term from the associated ioHandler. |
void |
send(byte operation,
aterm.ATerm aTerm)
Forwards a term to the associated ioHandler. |
void |
sendAckEvent(aterm.ATerm aTerm)
Sends an ack event to the with this tool instance associated tool. |
void |
sendDebugPerformanceStatsRequest()
Sends a debug performance statistics request to the with this tool instance associated tool. |
void |
sendDo(aterm.ATerm aTerm)
Sends a do request to the with this tool instance associated tool. |
void |
sendEval(aterm.ATerm aTerm)
Sends an evaluation request to the with this tool instance associated tool. |
void |
sendPerformanceStatsRequest(aterm.ATerm aTerm)
Sends a performance statistics request to the with this tool instance associated tool. |
void |
sendResponse(aterm.ATerm aTerm)
Sends an response to the with this tool instance associated tool. |
void |
sendTerminate(aterm.ATerm aTerm)
Sends a termination request to the with this tool instance associated tool. |
void |
setIOHandler(IIOHandler ioHandler)
Associates an ioHandler with the data handler. |
void |
setStreamHandler(StreamHandler streamHandler)
Sets the stream handler for this tool instance. |
java.lang.String |
showStatus()
Returns the status of this tool instance in string format. |
void |
shutDown()
Shuts down this dataHandler. |
void |
terminate()
Requests the termination of this dataHandler. |
boolean |
tryDoEval()
Notifies the tool instance that you want to send a DO or EVAL request to the tool and checks if this is possible. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private final ToolDefinition toolDef
private final ToolBus toolbus
private final TBTermFactory tbfactory
private volatile IIOHandler ioHandler
private volatile StreamHandler streamHandler
private static int toolNr
private final aterm.ATermAppl toolKey
private final int toolID
private final java.util.List<aterm.ATerm> valuesFromTool
private final java.util.List<aterm.ATerm> eventsFromTool
private final java.util.List<aterm.ATerm> requestsFromTool
private final java.util.List<aterm.ATerm> performanceStats
private volatile aterm.ATerm lastDebugPerformanceStats
private static final int UNCONNECTED
private static final int READY
private static final int BLOCKED
private static final int DISCONNECTED
private static final int KILLED
private static final int UNREACHABLE
private static final int TERMINATED
private volatile int state
private final java.lang.Object stateLock
Constructor Detail |
---|
public ToolInstance(ToolDefinition toolDef, ToolBus toolbus)
toolDef
- The definition of the tool.toolbus
- A reference to the toolbus associated with this tool instance.Method Detail |
---|
public void executeTool() throws ToolBusException
ToolBusException
- Thrown when the tool could not be executed.public aterm.ATermAppl getToolKey()
public int getToolID()
public java.lang.String getToolName()
public void setStreamHandler(StreamHandler streamHandler)
streamHandler
- The stream handler to use.public void setIOHandler(IIOHandler ioHandler)
IDataHandler
setIOHandler
in interface IDataHandler
ioHandler
- The I/O handler we need to associate with the data handler.IDataHandler.setIOHandler(IIOHandler)
public void receive(byte operation, aterm.ATerm aTerm)
IDataHandler
receive
in interface IDataHandler
operation
- The operation associate with the term we received.aTerm
- The term that was received.IDataHandler.receive(byte, ATerm)
public void sendAckEvent(aterm.ATerm aTerm)
aTerm
- The ack event.public void sendResponse(aterm.ATerm aTerm)
aTerm
- The response.public void sendDo(aterm.ATerm aTerm)
aTerm
- The do request.public void sendEval(aterm.ATerm aTerm)
aTerm
- The evaluation request.public void sendTerminate(aterm.ATerm aTerm)
aTerm
- The termination request.public void sendPerformanceStatsRequest(aterm.ATerm aTerm)
aTerm
- The performance statistics request.public void sendDebugPerformanceStatsRequest()
public void send(byte operation, aterm.ATerm aTerm)
IDataHandler
send
in interface IDataHandler
operation
- The operation associated with the term we need to send.aTerm
- The term that needs to be transmitted.IDataHandler.send(byte, ATerm)
public void terminate()
IDataHandler
terminate
in interface IDataHandler
IDataHandler.terminate()
public void shutDown()
IDataHandler
shutDown
in interface IDataHandler
IDataHandler.shutDown()
public boolean isExecutedTool()
public void kill()
public void exceptionOccured()
IDataHandler
exceptionOccured
in interface IDataHandler
IDataHandler.exceptionOccured()
public boolean getValueFromTool(aterm.ATerm pattern, Environment env)
pattern
- The signature we need to match on.env
- The enviroment in which we need to make updates, when a match have been made.
public boolean getEventFromTool(aterm.ATerm pattern, Environment env)
pattern
- The signature we need to match on.env
- The enviroment in which we need to make updates, when a match have been made.
public boolean getRequestFromTool(aterm.ATerm pattern, Environment env)
pattern
- The signature we need to match on.env
- The enviroment in which we need to make updates, when a match have been made.
public boolean getPerformanceStats(aterm.ATerm aTerm, Environment env)
aTerm
- The signature we need to match on.env
- The enviroment in which we need to make updates, when a match have been made.
public aterm.ATerm getLastDebugPerformanceStats()
private void goConnected()
public void goReady()
private void goDisconnected()
private void goTerminated()
private void goKilled()
private void goUnreachable()
public boolean isConnected()
public boolean isReady()
public boolean isDisconnected()
public boolean isTerminated()
public boolean isKilled()
public boolean isUnreachable()
public boolean tryDoEval()
public aterm.ATerm[] getQueuedValues()
public aterm.ATerm[] getQueuedEvents()
public aterm.ATerm[] getQueuedRequests()
public java.lang.String showStatus()
|
The Meta-Environment API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |