All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class JavaAgent.oplan.OPWriter

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

public class OPWriter
extends Thread
The OPWriter is the class that sends messages to O-Plan. It is a Thread to avoid blocking the OPAgent it belongs to.


Variable Index

 o oPlanProcess
the handle of the OPlan Process this OPWriter will write to
 o theOPAgent
the handle of the OPAgent this OPWriter belongs to

Constructor Index

 o OPWriter(OPAgent, Process)
Constructor for the Thread that writes to the OutputStream of the given Process.

Method Index

 o run()
This function is called when the Thread is started.
 o send(String)
This function places the given message in the queue of messages to be written to O-Plan.

Variables

 o theOPAgent
 protected OPAgent theOPAgent
the handle of the OPAgent this OPWriter belongs to

 o oPlanProcess
 protected Process oPlanProcess
the handle of the OPlan Process this OPWriter will write to

Constructors

 o OPWriter
 public OPWriter(OPAgent opa,
                 Process opp)
Constructor for the Thread that writes to the OutputStream of the given Process.

Parameters:
opa - the OPAgent to which this OPWriter belongs
opp - the Process to which messages will be written

Methods

 o run
 public void run()
This function is called when the Thread is started. It waits until there is a message for O-Plan available and the OPReader is not expecting further messages from O-Plan. Then it takes the first message off the queue, and writes it to O-Plan. It also informs the OPReader that it should expect a reply from O-Plan.

Overrides:
run in class Thread
 o send
 protected synchronized void send(String msg)
This function places the given message in the queue of messages to be written to O-Plan. A newline character will be added to the message at this point.

Parameters:
msg - the message to be written to O-Plan

All Packages  Class Hierarchy  This Package  Previous  Next  Index