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/unlimitednatural/GreaterOrEqual.java')
-rw-r--r--sandbox/Moka/org.eclipse.papyrus.moka.fuml.standardlibrary/src/org/eclipse/papyrus/moka/fuml/standardlibrary/library/unlimitednatural/GreaterOrEqual.java48
1 files changed, 48 insertions, 0 deletions
diff --git a/sandbox/Moka/org.eclipse.papyrus.moka.fuml.standardlibrary/src/org/eclipse/papyrus/moka/fuml/standardlibrary/library/unlimitednatural/GreaterOrEqual.java b/sandbox/Moka/org.eclipse.papyrus.moka.fuml.standardlibrary/src/org/eclipse/papyrus/moka/fuml/standardlibrary/library/unlimitednatural/GreaterOrEqual.java
new file mode 100644
index 00000000000..ae7b4d5f6df
--- /dev/null
+++ b/sandbox/Moka/org.eclipse.papyrus.moka.fuml.standardlibrary/src/org/eclipse/papyrus/moka/fuml/standardlibrary/library/unlimitednatural/GreaterOrEqual.java
@@ -0,0 +1,48 @@
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.moka.fuml.standardlibrary.library.unlimitednatural;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.papyrus.moka.fuml.Semantics.Classes.Kernel.BooleanValue;
+import org.eclipse.papyrus.moka.fuml.Semantics.Classes.Kernel.UnlimitedNaturalValue;
+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;
+import org.eclipse.papyrus.moka.fuml.debug.Debug;
+
+public class GreaterOrEqual extends OpaqueBehaviorExecution {
+
+ @Override
+ public void doBody(List<ParameterValue> inputParameters, List<ParameterValue> outputParameters) {
+ try {
+ Integer x = ((UnlimitedNaturalValue)inputParameters.get(0).values.get(0)).value;
+ Integer y = ((UnlimitedNaturalValue)inputParameters.get(1).values.get(0)).value;
+ BooleanValue result = new BooleanValue();
+ result.value = x == y || x < 0 || y >=0 && x > y ;
+ result.type = this.locus.factory.getBuiltInType("Boolean");
+ List<Value> outputs = new ArrayList<Value>();
+ outputs.add(result);
+ outputParameters.get(0).values = outputs;
+ } catch (Exception e) {
+ Debug.println("An error occured during the execution of >= " + e.getMessage());
+ }
+ }
+
+ @Override
+ public Value new_() {
+ return new GreaterOrEqual();
+ }
+}

Back to the top