All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class JavaAgent.oplan.OPReader

java.lang.Object
   |
   +----java.lang.Thread
           |
           +----JavaAgent.oplan.OPReader

public class OPReader
extends Thread
The OPReader is a Thread that reads all messages from OPlan. Messages are expected in brackets and all other output from OPlan is ignored, e.g. the initial text being printed.


Variable Index

 o oPlanProcess
the handle of the OPlan process from which is being read
 o theOPAgent
the handle of the OPAgent the created this OPReader

Constructor Index

 o OPReader(OPAgent, Process)
Constructor for the Thread that reads from the given Process which should be the OutputStream of an OPlan Process.

Method Index

 o expectMsg()
This function can be called to tell the OPReader that it should expect a message from OPlan.
 o msgExpected()
This function can be called to see whether there are currently messages expected from O-Plan.
 o run()
This method is called when the Thread is started.

Variables

 o theOPAgent
 protected OPAgent theOPAgent
the handle of the OPAgent the created this OPReader

 o oPlanProcess
 protected Process oPlanProcess
the handle of the OPlan process from which is being read

Constructors

 o OPReader
 public OPReader(OPAgent opa,
                 Process opp)
Constructor for the Thread that reads from the given Process which should be the OutputStream of an OPlan Process.

Parameters:
opa - the OPAgent to which this OPReader belongs
opp - the Process from which output will be read

Methods

 o run
 public void run()
This method is called when the Thread is started. It waits for output from the OPlan Process. Messages from O-Plan must be in brackets or they will be ignored. A message starts with a '(', then any text can follow including other brackets. They are being counted. When the matching ')' for the message is read, the message is considered complete.

Overrides:
run in class Thread
 o expectMsg
 protected synchronized void expectMsg()
This function can be called to tell the OPReader that it should expect a message from OPlan. Subsequent calls to msgExpected will return true until this OPReader has read a complete message from OPlan.

 o msgExpected
 protected synchronized boolean msgExpected()
This function can be called to see whether there are currently messages expected from O-Plan. Usually, these would be replies to messages sent by the OPWriter.

Returns:
whether a message from OPlan is currently expected

All Packages  Class Hierarchy  This Package  Previous  Next  Index