de.cau.cs.kieler.uml2.sim.kiem
Class DataComponent

java.lang.Object
  extended by de.cau.cs.kieler.sim.kiem.internal.AbstractDataComponent
      extended by de.cau.cs.kieler.sim.kiem.JSONObjectDataComponent
          extended by de.cau.cs.kieler.sim.kiem.ui.datacomponent.JSONObjectSimulationDataComponent
              extended by de.cau.cs.kieler.uml2.sim.kiem.DataComponent
All Implemented Interfaces:
IDataComponent, IJSONObjectDataComponent, IExecutableExtension
Direct Known Subclasses:
DataComponentModelCheck, DataComponentSim

public class DataComponent
extends JSONObjectSimulationDataComponent
implements IJSONObjectDataComponent

The Class DataComponent.

Rating red

Nested Class Summary
 
Nested classes/interfaces inherited from class de.cau.cs.kieler.sim.kiem.ui.datacomponent.JSONObjectSimulationDataComponent
JSONObjectSimulationDataComponent.M2MProgressMonitor
 
Field Summary
 String blaaa
           
 String errorMsg
           
protected static String MAUDEERROR
          The constant MAUDEERROR indicates the error token to search for.
protected static String MAUDENOACTION
          The Constant MAUDENOACTION no aktion (will not be displayed).
protected static String MAUDENOEVENT
          The Constant MAUDENOEVENT no event (will not be displayed).
protected static String MAUDEPARSESTATESTARTER
          The constant MAUDEPARSESTATESTARTER indicates the start token to search for.
 
Fields inherited from class de.cau.cs.kieler.sim.kiem.ui.datacomponent.JSONObjectSimulationDataComponent
activePage, activePageFlag, exception, modelEditor
 
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
DataComponent()
          Instantiates a new data component.
 
Method Summary
 boolean checkModelValidation(EObject rootEObject)
          Check the model validation.
protected  void clearConsole()
          Clears the maude console.
 void doModel2ModelTransform(KielerProgressMonitor monitor)
          Implementation of model 2 model transformation.
 JSONObject doProvideInitialVariables()
          Performs the normal provide initial variables method.
 KiemProperty[] doProvideProperties()
           
 JSONObject doStep(JSONObject signals)
          Implements the real step method for this simulation datacomponent.
 String[] extractActions(String maudeResult)
          Extract actions.
 List<String[]> extractActiveStates(String maudeResult)
          Extract the active states.
protected  String[] getAllActions()
          Gets all actions of the model (cached).
protected  String[] getAllEvents()
          Gets all events of the model (cached).
 String getCurrentStateIds(String[] currentStates)
          Constructs the currently active states using the original emf ids
 String getEMFId(String maudeStateId)
          Gets the (cashed) eMF id.
 String[] getInitialStates()
          Gets the initial states.
protected  IEditorPart getInputEditor()
           
protected  EObject getInputModelEObject(IEditorPart editorPart)
           
 String getMaudeBaseCodeLocation()
          Gets the maude base code location that must be included into the generated maude file that has to access these maude base files.
 String getMaudeGenCodeLocation()
          Gets the maude gen code location.
protected  View getNotationElement(IEditorPart diagramEditor)
           
protected  org.eclipse.xtend.XtendFacade getXtendFacade()
          Tries to gets the xtend facade, returns null otherwise.
 void initialize()
          Initialize.
static boolean isWindows()
          Checks whether the system is based on windows.
protected  void printConsole(String text)
          Prints to the maude console.
 void refreshWorkspace()
          Refresh workspace so that, e.g.
protected  void resetAllEventsAndActions()
          Reset all events and actions.
 void resetMappingHashmap()
          Reset the hashmap.
 String[] selectCurrentState(List<String[]> currentStatesChoicesParam)
           
 String transformToCygwinPath(String WindowsPath)
          Transforms a normal Windows path into a cygwin path because Maude for Windows is compiled w/ cygwin.
 void wrapup()
          Wrap-up.
 
Methods inherited from class de.cau.cs.kieler.sim.kiem.ui.datacomponent.JSONObjectSimulationDataComponent
bringProblemsViewToFront, checkProperties, getActivePage, getEditor, getInputModel, getInputModelAsURI, getInputResourceSet, getInputWorkspaceModel, getModelRootElement, isObserver, isProducer, isTransformationCompleted, isTransformationError, provideFilterKeysJSON, provideInitialVariables, provideProperties, resolveBundelFile, step
 
Methods inherited from class de.cau.cs.kieler.sim.kiem.JSONObjectDataComponent
getInitialVariables, setInitialVariables
 
Methods inherited from class de.cau.cs.kieler.sim.kiem.internal.AbstractDataComponent
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, setConfigurationElemenet, setCurrentComponentID, setHistoryStep, setInitializationData, setProperties
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface de.cau.cs.kieler.sim.kiem.IJSONObjectDataComponent
step
 

Field Detail

MAUDEPARSESTATESTARTER

protected static final String MAUDEPARSESTATESTARTER
The constant MAUDEPARSESTATESTARTER indicates the start token to search for.

See Also:
Constant Field Values

MAUDENOEVENT

protected static final String MAUDENOEVENT
The Constant MAUDENOEVENT no event (will not be displayed).

See Also:
Constant Field Values

MAUDENOACTION

protected static final String MAUDENOACTION
The Constant MAUDENOACTION no aktion (will not be displayed).

See Also:
Constant Field Values

MAUDEERROR

protected static final String MAUDEERROR
The constant MAUDEERROR indicates the error token to search for.

See Also:
Constant Field Values

errorMsg

public String errorMsg

blaaa

public String blaaa
Constructor Detail

DataComponent

public DataComponent()
Instantiates a new data component.

Method Detail

getInputModelEObject

protected EObject getInputModelEObject(IEditorPart editorPart)
Overrides:
getInputModelEObject in class JSONObjectSimulationDataComponent

doProvideProperties

public KiemProperty[] doProvideProperties()
Overrides:
doProvideProperties in class JSONObjectSimulationDataComponent

getInitialStates

public String[] getInitialStates()
Gets the initial states.

Returns:
the initial states

extractActiveStates

public List<String[]> extractActiveStates(String maudeResult)
Extract the active states.

Parameters:
maudeResult - the maude result if any, empty list if no solution found
Returns:
the string[]

extractActions

public String[] extractActions(String maudeResult)
Extract actions.

Parameters:
maudeResult - the maude result
Returns:
the string[]

getCurrentStateIds

public String getCurrentStateIds(String[] currentStates)
Constructs the currently active states using the original emf ids

Returns:
the current state ids

resetMappingHashmap

public void resetMappingHashmap()
Reset the hashmap.


getEMFId

public String getEMFId(String maudeStateId)
Gets the (cashed) eMF id.

Parameters:
maudeStateId - the maude state id
Returns:
the eMF id

doStep

public JSONObject doStep(JSONObject signals)
                  throws KiemExecutionException
Description copied from class: JSONObjectSimulationDataComponent
Implements the real step method for this simulation datacomponent.

Overrides:
doStep in class JSONObjectSimulationDataComponent
Parameters:
signals - the j son object
Returns:
the jSON object
Throws:
KiemExecutionException - the kiem execution exception

selectCurrentState

public String[] selectCurrentState(List<String[]> currentStatesChoicesParam)

initialize

public void initialize()
                throws KiemInitializationException
Description copied from interface: IDataComponent
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
Overrides:
initialize in class JSONObjectSimulationDataComponent
Throws:
KiemInitializationException - a KiemInitializationException

wrapup

public void wrapup()
            throws KiemInitializationException
Description copied from interface: IDataComponent
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
Throws:
KiemInitializationException - a KiemInitializationException

refreshWorkspace

public void refreshWorkspace()
Refresh workspace so that, e.g. the Project Explorer is updated to display the generated maude file.


getMaudeGenCodeLocation

public String getMaudeGenCodeLocation()
Gets the maude gen code location. It is the same path where the original source file lives just ending with the maude file extension instead of uml.

Returns:
the maude gen code location

getMaudeBaseCodeLocation

public String getMaudeBaseCodeLocation()
Gets the maude base code location that must be included into the generated maude file that has to access these maude base files.

Returns:
the maude base code location

isWindows

public static boolean isWindows()
Checks whether the system is based on windows.

Returns:
true, if is windows

transformToCygwinPath

public String transformToCygwinPath(String WindowsPath)
Transforms a normal Windows path into a cygwin path because Maude for Windows is compiled w/ cygwin.

Parameters:
WindowsPath - the windows path
Returns:
the string

doModel2ModelTransform

public void doModel2ModelTransform(KielerProgressMonitor monitor)
                            throws Exception
Description copied from class: JSONObjectSimulationDataComponent
Implementation of model 2 model transformation.

Overrides:
doModel2ModelTransform in class JSONObjectSimulationDataComponent
Parameters:
monitor - the monitor
Throws:
Exception - the exception

checkModelValidation

public boolean checkModelValidation(EObject rootEObject)
Description copied from class: JSONObjectSimulationDataComponent
Check the model validation. Should return true if the model is valid, false otherwise.

Example:
Region syncChart = (de.cau.cs.kieler.synccharts.Region) rootEObject;
Diagnostic diagnostic = diagnostician.validate(syncChart);
int serenity = diagnostic.getSeverity();
return (serenity == Diagnostic.OK);

Overrides:
checkModelValidation in class JSONObjectSimulationDataComponent
Returns:
true, if successful

resetAllEventsAndActions

protected void resetAllEventsAndActions()
Reset all events and actions.


getAllEvents

protected String[] getAllEvents()
Gets all events of the model (cached).

Returns:
the events

getAllActions

protected String[] getAllActions()
Gets all actions of the model (cached).

Returns:
the actions

getXtendFacade

protected org.eclipse.xtend.XtendFacade getXtendFacade()
Tries to gets the xtend facade, returns null otherwise.

Returns:
the xtend facade

doProvideInitialVariables

public JSONObject doProvideInitialVariables()
                                     throws KiemInitializationException
Description copied from class: JSONObjectSimulationDataComponent
Performs the normal provide initial variables method.

Overrides:
doProvideInitialVariables in class JSONObjectSimulationDataComponent
Returns:
the jSON object
Throws:
KiemInitializationException - the kiem initialization exception

getNotationElement

protected View getNotationElement(IEditorPart diagramEditor)
Overrides:
getNotationElement in class JSONObjectSimulationDataComponent

getInputEditor

protected IEditorPart getInputEditor()
Overrides:
getInputEditor in class JSONObjectSimulationDataComponent

clearConsole

protected void clearConsole()
Clears the maude console.


printConsole

protected void printConsole(String text)
Prints to the maude console.

Parameters:
text - the text