de.cau.cs.kieler.sim.kiem.execution
Class ObserverExecution

java.lang.Object
  extended by de.cau.cs.kieler.sim.kiem.execution.ObserverExecution
All Implemented Interfaces:
Runnable

public class ObserverExecution
extends Object
implements Runnable

The Class ObserverExecution. This implements the behavior of an observer worker thread that operates on one dedicated DataComponenet that is a pure observer.

An observer not needs to get finished during one execution step but may be skipped when it not finishes until it should be called in a consecutive execution step.

It sleeps until it is called and indicates that it is ready for the next step with its done flag.

Rating proposed yellow
(2009-01-15)

Constructor Summary
ObserverExecution(AbstractDataComponent dataComponentParam, Execution parentParam)
          Instantiates a new observer execution worker thread.
 
Method Summary
 void run()
          When an object implementing interface Runnable is used to create a thread, starting the thread causes the object's run method to be called in that separately executing thread.
 void setData(JSONObject dataParam)
          Sets the input JSON data for the observer DataComponent.
 boolean step()
          Schedules a new step of the observer DataComponent.
 void stopExecution()
          Terminates the execution of this thread.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ObserverExecution

public ObserverExecution(AbstractDataComponent dataComponentParam,
                         Execution parentParam)
Instantiates a new observer execution worker thread.

Parameters:
dataComponentParam - the affected DataComponent
parentParam - the parent execution
Method Detail

step

public boolean step()
Schedules a new step of the observer DataComponent. If the component is not ready yet then false is returned. Otherwise the worker thread is awakened and true is returned.

Returns:
true, if step is successfully scheduled

setData

public void setData(JSONObject dataParam)
Sets the input JSON data for the observer DataComponent.

Parameters:
dataParam - the input data

stopExecution

public void stopExecution()
Terminates the execution of this thread.


run

public void run()
When an object implementing interface Runnable is used to create a thread, starting the thread causes the object's run method to be called in that separately executing thread.

Specified by:
run in interface Runnable