de.cau.cs.kieler.sim.table
Class DataProducer

java.lang.Object
  extended by de.cau.cs.kieler.sim.kiem.internal.AbstractDataComponent
      extended by de.cau.cs.kieler.sim.kiem.JSONStringDataComponent
          extended by de.cau.cs.kieler.sim.table.DataProducer
All Implemented Interfaces:
IDataComponent, IJSONStringDataComponent, IExecutableExtension

public class DataProducer
extends JSONStringDataComponent
implements IJSONStringDataComponent

The class DataProducer implements the producer DataComponent which should be scheduled before any observer DataComponents. In its step(String) method it produces data according to the variables and signals that where modified by the user in the table's ViewPart.

Rating red

Field Summary
 
Fields inherited from class de.cau.cs.kieler.sim.kiem.internal.AbstractDataComponent
MASTER_CMD_MACROSTEP, MASTER_CMD_PAUSE, MASTER_CMD_RUN, MASTER_CMD_STEP, MASTER_CMD_STEPBACK, MASTER_CMD_STOP
 
Constructor Summary
DataProducer()
          Instantiates a new producer DataComponent.
 
Method Summary
 void initialize()
          Initialize.
 boolean isObserver()
          To check whether the DataComponent is an observer.
 boolean isProducer()
          To check whether the DataComponent is a producer.
 String step(String jSONString)
          Step method for a DataObserver and a DataProducer.
 void wrapup()
          Wrap-up.
 
Methods inherited from class de.cau.cs.kieler.sim.kiem.JSONStringDataComponent
getInitialVariables, provideInitialVariables, setInitialVariables
 
Methods inherited from class de.cau.cs.kieler.sim.kiem.internal.AbstractDataComponent
checkProperties, finalize, getConfigurationElement, getCurrentComponentID, getDataComponentId, getName, getPluginId, getProperties, getShell, isDeltaObserver, isHistoryObserver, isHistoryStep, isInvisible, isMacroStepDone, isMaster, isMasterImplementingGUI, isMultiInstantiable, masterCommand, masterGetAimedStepDuration, masterGUI, masterGUIisEnabled, masterIsPaused, masterIsRunning, masterSetAimedStepDuration, masterSetKIEMInstance, notifyEvent, provideEventOfInterest, provideFilterKeys, provideProperties, setConfigurationElemenet, setCurrentComponentID, setHistoryStep, setInitializationData, setProperties
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DataProducer

public DataProducer()
Instantiates a new producer DataComponent.

Method Detail

step

public String step(String jSONString)
Step method for a DataObserver and a DataProducer.

For a producer only the argument will always be null. For an observer only this method will be called asynchronous. This may mean that in case the observer is slow, it may be skipped at some consecutive steps until it becomes ready again. If this is not desired and the observer MUST NOT be skipped, then the DataComponent should also be a DataProducer but return just null.

If an error occurs during the execution of the step method, a DataComponent should raise a KiemExecutionException that is then catched by the execution manager an brought to the user's attention.

Specified by:
step in interface IJSONStringDataComponent
Parameters:
jSONString - the concrete JSONString of input data (if observer)
Returns:
the JSONString with the output data (if producer)

initialize

public void initialize()
Initialize. Do some initializing prior to execution. If an error occurs during initialization, the DataComponent should raise a KiemInitializationException.

Specified by:
initialize in interface IDataComponent

isObserver

public boolean isObserver()
To check whether the DataComponent is an observer. If the DataComponent is an observer the arguments in its step() method will be != null.

Specified by:
isObserver in interface IDataComponent
Returns:
true, if is observer

isProducer

public boolean isProducer()
To check whether the DataComponent is a producer. If the DataComponent is a producer it should return != null in its step() method.

Specified by:
isProducer in interface IDataComponent
Returns:
true, if is producer

wrapup

public void wrapup()
Wrap-up. Do some wrapping-up after execution has finished. If an error occurs during wrap up, the DataComponent should raise a KiemInitializationException.

Specified by:
wrapup in interface IDataComponent