Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'sandbox/Moka/org.eclipse.papyrus.moka.fuml.standardlibrary/src/org/eclipse/papyrus/moka/fuml/standardlibrary/library/real/ToReal.java')
-rw-r--r--sandbox/Moka/org.eclipse.papyrus.moka.fuml.standardlibrary/src/org/eclipse/papyrus/moka/fuml/standardlibrary/library/real/ToReal.java35
1 files changed, 35 insertions, 0 deletions
diff --git a/sandbox/Moka/org.eclipse.papyrus.moka.fuml.standardlibrary/src/org/eclipse/papyrus/moka/fuml/standardlibrary/library/real/ToReal.java b/sandbox/Moka/org.eclipse.papyrus.moka.fuml.standardlibrary/src/org/eclipse/papyrus/moka/fuml/standardlibrary/library/real/ToReal.java
new file mode 100644
index 00000000000..90efe8c0aa9
--- /dev/null
+++ b/sandbox/Moka/org.eclipse.papyrus.moka.fuml.standardlibrary/src/org/eclipse/papyrus/moka/fuml/standardlibrary/library/real/ToReal.java
@@ -0,0 +1,35 @@
+package org.eclipse.papyrus.moka.fuml.standardlibrary.library.real;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.papyrus.infra.core.Activator;
+import org.eclipse.papyrus.moka.fuml.Semantics.Classes.Kernel.RealValue;
+import org.eclipse.papyrus.moka.fuml.Semantics.Classes.Kernel.StringValue;
+import org.eclipse.papyrus.moka.fuml.Semantics.Classes.Kernel.Value;
+import org.eclipse.papyrus.moka.fuml.Semantics.CommonBehaviors.BasicBehaviors.OpaqueBehaviorExecution;
+import org.eclipse.papyrus.moka.fuml.Semantics.CommonBehaviors.BasicBehaviors.ParameterValue;
+
+public class ToReal extends OpaqueBehaviorExecution {
+
+ @Override
+ public void doBody(List<ParameterValue> inputParameters, List<ParameterValue> outputParameters) {
+ try {
+ String x = ((StringValue)inputParameters.get(0).values.get(0)).value;
+ RealValue result = new RealValue();
+ result.value = new Double(x);
+ result.type = this.locus.factory.getBuiltInType("Real");
+ List<Value> outputs = new ArrayList<Value>();
+ outputs.add(result);
+ outputParameters.get(0).values = outputs;
+ } catch (Exception e) {
+ Activator.log.error("An error occured during the execution of ToReal " + e.getMessage(), e);
+ }
+ }
+
+ @Override
+ public Value new_() {
+ // ADDED
+ return new ToReal();
+ }
+} \ No newline at end of file

Back to the top