haifa.shopsim.UI
Class ShopTraceMaker

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--haifa.shopsim.UI.ShopTraceMaker
All Implemented Interfaces:
java.util.EventListener, java.lang.Runnable, ShopChangeListener, Traceable

class ShopTraceMaker
extends java.lang.Thread
implements Traceable, ShopChangeListener

This class is a thread that constntly waits for ShopChangedEvents and converts them to proper events for the Gantt Chart. It is basically an interaface between Fred Howells SimJava events that pass betweeen entites and this projects ShopChangedEvents.

Version:
1.1

Field Summary
private  boolean gotDisplayCommand
          Used for wait and notify when waiting for display commands
private  boolean gotShopEvent
          Used for wait and notify when waiting on new traces
private  int numDisplayTraces
          The number of display traces.
private  int numForwardedTraces
          The number of forwardedTraces.
private  boolean running
          True as long as thread is running.
protected  ShopChangeEvent shopChangeEvent
          The shopChange event that is currently being handled.
protected  ShopData shopData
          A refrence to the Shop Data Object.
private  java.util.Vector traceListeners
          A vector of the listeners to this trace.
 
Fields inherited from class java.lang.Thread
contextClassLoader, daemon, eetop, group, inheritableThreadLocals, inheritedAccessControlContext, MAX_PRIORITY, MIN_PRIORITY, name, NORM_PRIORITY, priority, single_step, stillborn, stopThreadPermission, target, threadInitNumber, threadLocals, threadQ
 
Fields inherited from interface eduni.simdiag.Traceable
DISPLAY, LAYOUT, PAUSE, RUN, STOP, TRACE
 
Constructor Summary
ShopTraceMaker(ShopData shopData_)
          Creates new ShopTraceMaker
 
Method Summary
 void addTraceListener(TraceListener l)
          Javabeans trace event output
 void forwardTrace(TraceEventObject e)
          Sends trace event onwards to any listeners
 void kill()
          Stops the ShopTraceMaker, should be called.
 void removeTraceListener(TraceListener l)
          Javabeans trace event output
 void run()
           
 void sendDisplayTrace()
          Causes the ShopTraceMaker to send a dispaly trace, this method blocks untill the display trace was sent.
 void shopChanged(ShopChangeEvent sce)
          Handle incoming shopchangeevents.
 
Methods inherited from class java.lang.Thread
, activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, exit, getContextClassLoader, getName, getPriority, getThreadGroup, init, interrupt, interrupt0, interrupted, isAlive, isDaemon, isInterrupted, isInterrupted, join, join, join, nextThreadNum, registerNatives, resume, resume0, setContextClassLoader, setDaemon, setName, setPriority, setPriority0, sleep, sleep, start, stop, stop, stop0, suspend, suspend0, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

shopData

protected ShopData shopData
A refrence to the Shop Data Object.

shopChangeEvent

protected ShopChangeEvent shopChangeEvent
The shopChange event that is currently being handled.

gotShopEvent

private boolean gotShopEvent
Used for wait and notify when waiting on new traces

gotDisplayCommand

private boolean gotDisplayCommand
Used for wait and notify when waiting for display commands

running

private boolean running
True as long as thread is running.

traceListeners

private java.util.Vector traceListeners
A vector of the listeners to this trace.

numForwardedTraces

private int numForwardedTraces
The number of forwardedTraces.

numDisplayTraces

private int numDisplayTraces
The number of display traces.
Constructor Detail

ShopTraceMaker

public ShopTraceMaker(ShopData shopData_)
Creates new ShopTraceMaker
Method Detail

kill

public void kill()
Stops the ShopTraceMaker, should be called.

run

public void run()
Overrides:
run in class java.lang.Thread

shopChanged

public void shopChanged(ShopChangeEvent sce)
Handle incoming shopchangeevents.
Specified by:
shopChanged in interface ShopChangeListener

sendDisplayTrace

public void sendDisplayTrace()
Causes the ShopTraceMaker to send a dispaly trace, this method blocks untill the display trace was sent.

addTraceListener

public void addTraceListener(TraceListener l)
Javabeans trace event output

removeTraceListener

public void removeTraceListener(TraceListener l)
Javabeans trace event output

forwardTrace

public void forwardTrace(TraceEventObject e)
Sends trace event onwards to any listeners