|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectlij.runtime.Interpreter
public class Interpreter
The main interpreter class. This is the starting point for loading and executing an IM.
Field Summary | |
---|---|
private java.util.ArrayList<AgentInstance> |
agents
|
private Framework |
framework
|
private boolean |
isRunning
|
private LetterBox |
letterBox
|
private Monitor |
monitor
|
Constructor Summary | |
---|---|
Interpreter(java.io.InputStream is)
Constructor. |
|
Interpreter(java.io.InputStream is,
boolean enableMonitor)
Constructor. |
Method Summary | |
---|---|
AgentInstance |
getAgent(java.io.Serializable id)
Locates and returns a pointer to the AgentInstance with the specified id. |
java.util.ArrayList<AgentInstance> |
getAgents()
Accessor. |
Framework |
getFramework()
Accessor. |
private java.util.ArrayList<Term> |
getMissingRoles()
Returns a list of all the roles that are necessary for the execution of the IM, that still need a subscriber. |
Monitor |
getMonitor()
Accessor. |
ClauseInstance |
instantiateClause(Term newType,
java.io.Serializable newID,
java.io.Serializable[] arguments)
Creates and returns a ClauseInstance object. |
Letter |
receiveLetter(LetterPostData postData)
Searches for the proper recepient agent of the specified letter, and posts it to it. |
void |
run()
Starts the execution of the IM. |
void |
sendLetter(Letter letter)
Searches for the proper recepient agent of the specified letter, and posts it to it. |
void |
subscribe(java.lang.String roleName,
ConstraintImplementor constraintImplementor)
Creates and adds a new agent subscription, using the default ID. |
void |
subscribe(java.lang.String roleName,
ConstraintImplementor constraintImplementor,
java.io.Serializable id)
Creates and adds a new agent subscription. |
private void |
waitForRequiredImplementors()
This method will block until agents for all of the necessary roles specified in the IM have been subscribed. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private Monitor monitor
private Framework framework
private java.util.ArrayList<AgentInstance> agents
private LetterBox letterBox
private boolean isRunning
Constructor Detail |
---|
public Interpreter(java.io.InputStream is) throws java.io.FileNotFoundException, ParseException, InterpreterException
is
- An InputStream that will provide the LCC protocol file.
java.io.FileNotFoundException
ParseException
InterpreterException
public Interpreter(java.io.InputStream is, boolean enableMonitor) throws java.io.FileNotFoundException, ParseException, InterpreterException
is
- An InputStream that will provide the LCC protocol file.enableMonitor
- If true, the interpreter monitor GUI frame will be activated and displayed.
java.io.FileNotFoundException
ParseException
InterpreterException
Method Detail |
---|
public Monitor getMonitor()
public Framework getFramework()
public java.util.ArrayList<AgentInstance> getAgents()
public AgentInstance getAgent(java.io.Serializable id)
id
- The ID of the required agent.
public void subscribe(java.lang.String roleName, ConstraintImplementor constraintImplementor) throws InterpreterException
roleName
- The role name.constraintImplementor
- A ConstraintImplementor implementation, that will provide implementations for the constraint methods.
InterpreterException
public void subscribe(java.lang.String roleName, ConstraintImplementor constraintImplementor, java.io.Serializable id) throws InterpreterException
roleName
- The role name.constraintImplementor
- A ConstraintImplementor implementation, that will provide implementations for the constraint methods.id
- The ID of the agent being subscribed.
InterpreterException
public void run() throws InterpreterException
InterpreterException
public ClauseInstance instantiateClause(Term newType, java.io.Serializable newID, java.io.Serializable[] arguments) throws InterpreterException
newType
- The type of the Clause to instantiate.newID
- The ID of the agent executing the clause.arguments
- The arguments to be passed to the ClauseInstance.
InterpreterException
public void sendLetter(Letter letter) throws InterpreterException
letter
- The letter to send.
InterpreterException
public Letter receiveLetter(LetterPostData postData) throws InterpreterException
postData
- The post data of the message of the expected Letter.
InterpreterException
private void waitForRequiredImplementors()
private java.util.ArrayList<Term> getMissingRoles()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |