    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.

##

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

##

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

##

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

##

theOPAgent

     protected OPAgent theOPAgent

  the handle of the OPAgent this OPWriter belongs to

oPlanProcess

     protected Process oPlanProcess

  the handle of the OPlan Process this OPWriter will write to

##

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

##

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

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