    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.

##

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

##

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

##

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

##

theOPAgent

     protected OPAgent theOPAgent

  the handle of the OPAgent the created this OPReader

oPlanProcess

     protected Process oPlanProcess

  the handle of the OPlan process from which is being read

##

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

##

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

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.

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