bp
Class BThread

java.lang.Object
  extended by bp.BThread
Direct Known Subclasses:
HelloWorld.DisplayEvents, HelloWorld.Interleave, HelloWorld.SayGoodEvening, HelloWorld.SayGoodMorning, Test1.Bt1, Test1.Bt2, Test1.Bt3

public abstract class BThread
extends java.lang.Object

A base class for behavior thread


Field Summary
(package private)  EventFilterInterface blockedEvents
           
protected  EventFilterInterface interruptingEvents
          The set of events that will interrupt this scenario.
(package private)  java.lang.Double priority
           
(package private)  java.lang.Iterable<Event> requestedEvents
          Temporary storage for bpSync parameters
(package private)  JavaThreadForBThread thread
          The thread that executes this scenario
(package private)  EventFilterInterface watchedEvents
           
 
Constructor Summary
BThread()
           
 
Method Summary
protected  void bpSync(java.lang.Iterable<Event> requestedEvents, EventFilterInterface watchedEvents, EventFilterInterface blockedEvents)
          Wait for the next event.
(package private)  boolean isRequested(Event event)
           
abstract  void runBThread()
          The function that implements the BThread.
 void startBThread()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

priority

java.lang.Double priority

requestedEvents

java.lang.Iterable<Event> requestedEvents
Temporary storage for bpSync parameters


watchedEvents

EventFilterInterface watchedEvents

blockedEvents

EventFilterInterface blockedEvents

interruptingEvents

protected EventFilterInterface interruptingEvents
The set of events that will interrupt this scenario.


thread

JavaThreadForBThread thread
The thread that executes this scenario

Constructor Detail

BThread

public BThread()
Method Detail

runBThread

public abstract void runBThread()
                         throws java.lang.InterruptedException
The function that implements the BThread. Subclasses of BThread should override this method.

Throws:
java.lang.InterruptedException

startBThread

public void startBThread()
See Also:
Thread.start()

bpSync

protected void bpSync(java.lang.Iterable<Event> requestedEvents,
                      EventFilterInterface watchedEvents,
                      EventFilterInterface blockedEvents)
               throws java.lang.InterruptedException
Wait for the next event. Sleep until all scenarios call this function.

Parameters:
eos - A flag that is positive only when the function is called at the end of a scenario. In this case, we don't need to sleep.
Throws:
java.lang.InterruptedException
NotAScenarioException - Raised if the current context is not a scenario.
java.lang.InterruptedException - Raised when an outside thread interrupts this scenario.

isRequested

boolean isRequested(Event event)