[C++ Gen] Issue with TimeEvent in statemachines [message #1810556] |
Tue, 13 August 2019 09:11  |
Eclipse User |
|
|
|
Hello,
I would use TimeEvent as trigger for state machine transition.
- I created a TimeEvent
- Set Is relative to true
- Fill when field with a TimeExpression
-Fill time expression with a name (t) and an OpaqueExpression (10.0 for example)
But I can't generate C++ code from this example. I obtain an Exception during the transformation:
java.lang.NullPointerException
at sun.misc.FloatingDecimal.readJavaFormatString(Unknown Source)
at sun.misc.FloatingDecimal.parseFloat(Unknown Source)
at java.lang.Float.parseFloat(Unknown Source)
at java.lang.Float.valueOf(Unknown Source)
at org.eclipse.papyrus.designer.transformation.vsl.ParseVSL.getDurationFromVSL(ParseVSL.java:109)
at org.eclipse.papyrus.designer.transformation.vsl.ParseVSL.getMsDurationFromVSL(ParseVSL.java:121)
at org.eclipse.papyrus.designer.transformation.languages.cpp.library.statemachine.SM2ClassesTransformationCore.transform(SM2ClassesTransformationCore.java:653)
at org.eclipse.papyrus.designer.transformation.languages.cpp.library.statemachine.CompleteStatemachine.transformElement(CompleteStatemachine.java:59)
at org.eclipse.papyrus.designer.transformation.library.transformations.CompleteStatemachine.transformElement(CompleteStatemachine.java:44)
at org.eclipse.papyrus.designer.transformation.core.transformations.ApplyRecursive.applyRecursiveSub(ApplyRecursive.java:75)
at org.eclipse.papyrus.designer.transformation.core.transformations.ApplyRecursive.applyRecursiveSub(ApplyRecursive.java:92)
at org.eclipse.papyrus.designer.transformation.core.transformations.ApplyRecursive.applyRecursiveSub(ApplyRecursive.java:92)
at org.eclipse.papyrus.designer.transformation.core.transformations.ApplyRecursive.applyRecursiveSub(ApplyRecursive.java:92)
at org.eclipse.papyrus.designer.transformation.core.transformations.ApplyRecursive.applyRecursive(ApplyRecursive.java:51)
at org.eclipse.papyrus.designer.transformation.core.transformations.ExecuteTransformation.apply(ExecuteTransformation.java:53)
at org.eclipse.papyrus.designer.transformation.core.transformations.ExecuteTransformation.apply(ExecuteTransformation.java:54)
at org.eclipse.papyrus.designer.transformation.core.transformations.ExecuteTransformation.apply(ExecuteTransformation.java:58)
at org.eclipse.papyrus.designer.transformation.core.transformations.ExecuteChainUtil.apply(ExecuteChainUtil.java:68)
at org.eclipse.papyrus.designer.transformation.core.transformations.ExecuteTransformationChain.executeTransformation(ExecuteTransformationChain.java:211)
at org.eclipse.papyrus.designer.transformation.core.transformations.ExecuteTransformationChain.executeTransformation(ExecuteTransformationChain.java:134)
at org.eclipse.papyrus.designer.transformation.core.transformations.ExecuteTransformationChain.executeTransformation(ExecuteTransformationChain.java:116)
at org.eclipse.papyrus.cil4sys.useraction.handlers.CodeGenerationHandler$1.runInUIThread(CodeGenerationHandler.java:62)
at org.eclipse.ui.progress.UIJob.lambda$0(UIJob.java:98)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:40)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:185)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3919)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3550)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1173)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1062)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:155)
at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:644)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:566)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:155)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:137)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:107)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:400)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:661)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:597)
at org.eclipse.equinox.launcher.Main.run(Main.java:1476)
at org.eclipse.equinox.launcher.Main.main(Main.java:1449)
This is the relevant code :
public static long getDurationFromVSL(String nfpDuration) {
if (nfpDuration != null) {
String unit = MarteUtils.getValueFromTuple(nfpDuration, UNIT);
String value = MarteUtils.getValueFromTuple(nfpDuration, VALUE);
return Float.valueOf(value).intValue() * getMultiplicatorFromTimeUnit(unit);
}
return 0;
}
Should I use a special string format? And if yes which one? Is this feature available in C++ code generation, if yes is there somthing to set in addition?
Regards.
Yoann.
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03347 seconds