|
@@ -1,5 +1,5 @@
|
|
|
/**
|
|
/**
|
|
|
- * Copyright (c) 2010 committers of YAKINDU and others.
|
|
|
|
|
|
|
+ * Copyright (c) 2011 committers of YAKINDU and others.
|
|
|
* All rights reserved. This program and the accompanying materials
|
|
* All rights reserved. This program and the accompanying materials
|
|
|
* are made available under the terms of the Eclipse Public License v1.0
|
|
* are made available under the terms of the Eclipse Public License v1.0
|
|
|
* which accompanies this distribution, and is available at
|
|
* which accompanies this distribution, and is available at
|
|
@@ -10,136 +10,182 @@
|
|
|
*/
|
|
*/
|
|
|
package org.yakindu.sct.simulation.runtime.stext;
|
|
package org.yakindu.sct.simulation.runtime.stext;
|
|
|
|
|
|
|
|
-
|
|
|
|
|
public class CoreFunction extends Function {
|
|
public class CoreFunction extends Function {
|
|
|
-
|
|
|
|
|
- public static String EQUALS = "==";
|
|
|
|
|
- public static String NOT_EQUALS = "!=";
|
|
|
|
|
- public static String SMALLER = "<";
|
|
|
|
|
- public static String SMALLER_EQUAL = "<=";
|
|
|
|
|
- public static String GREATER = ">";
|
|
|
|
|
- public static String GREATER_EQUAL = ">=";
|
|
|
|
|
-
|
|
|
|
|
- public static String BIT_AND = "&";
|
|
|
|
|
- public static String BIT_OR = "|";
|
|
|
|
|
- public static String BIT_XOR = "^";
|
|
|
|
|
- public static String BIT_LSHIFT = "<<";
|
|
|
|
|
- public static String BIT_RSHIFT = ">>";
|
|
|
|
|
|
|
+
|
|
|
|
|
+ public static String EQUALS = "==";
|
|
|
|
|
+ public static String NOT_EQUALS = "!=";
|
|
|
|
|
+ public static String SMALLER = "<";
|
|
|
|
|
+ public static String SMALLER_EQUAL = "<=";
|
|
|
|
|
+ public static String GREATER = ">";
|
|
|
|
|
+ public static String GREATER_EQUAL = ">=";
|
|
|
|
|
+
|
|
|
|
|
+ public static String BIT_AND = "&";
|
|
|
|
|
+ public static String BIT_OR = "|";
|
|
|
|
|
+ public static String BIT_XOR = "^";
|
|
|
|
|
+ public static String BIT_LSHIFT = "<<";
|
|
|
|
|
+ public static String BIT_RSHIFT = ">>";
|
|
|
public static String BIT_COMPLEMENT = "~";
|
|
public static String BIT_COMPLEMENT = "~";
|
|
|
-
|
|
|
|
|
- public static String PLUS = "+";
|
|
|
|
|
- public static String MINUS = "-";
|
|
|
|
|
- public static String MULTIPLY = "*";
|
|
|
|
|
- public static String DIVIDE = "/";
|
|
|
|
|
- public static String MODULO = "%";
|
|
|
|
|
-
|
|
|
|
|
- public static String POSITIVE = "+";
|
|
|
|
|
- public static String NEGATIVE = "-";
|
|
|
|
|
- public static String NOT = "!";
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
|
|
+ public static String PLUS = "+";
|
|
|
|
|
+ public static String MINUS = "-";
|
|
|
|
|
+ public static String MULTIPLY = "*";
|
|
|
|
|
+ public static String DIVIDE = "/";
|
|
|
|
|
+ public static String MODULO = "%";
|
|
|
|
|
+
|
|
|
|
|
+ public static String POSITIVE = "+";
|
|
|
|
|
+ public static String NEGATIVE = "-";
|
|
|
|
|
+ public static String NOT = "!";
|
|
|
|
|
+
|
|
|
@FunctionMethod("+")
|
|
@FunctionMethod("+")
|
|
|
public Integer plus(Integer i1, Integer i2) {
|
|
public Integer plus(Integer i1, Integer i2) {
|
|
|
return i1 + i2;
|
|
return i1 + i2;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
@FunctionMethod("+")
|
|
@FunctionMethod("+")
|
|
|
public Float plus(Float f1, Float f2) {
|
|
public Float plus(Float f1, Float f2) {
|
|
|
return f1 + f2;
|
|
return f1 + f2;
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @FunctionMethod("+")
|
|
|
|
|
+ public Float plus(Integer f1, Float f2) {
|
|
|
|
|
+ return f1 + f2;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @FunctionMethod("+")
|
|
|
|
|
+ public Float plus(Float f1, Integer f2) {
|
|
|
|
|
+ return f1 + f2;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
@FunctionMethod("+")
|
|
@FunctionMethod("+")
|
|
|
public Integer positive(Integer i) {
|
|
public Integer positive(Integer i) {
|
|
|
return i;
|
|
return i;
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
@FunctionMethod("+")
|
|
@FunctionMethod("+")
|
|
|
public Float positive(Float f) {
|
|
public Float positive(Float f) {
|
|
|
return f;
|
|
return f;
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
@FunctionMethod("-")
|
|
@FunctionMethod("-")
|
|
|
public Integer negative(Integer i) {
|
|
public Integer negative(Integer i) {
|
|
|
return -i;
|
|
return -i;
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
@FunctionMethod("-")
|
|
@FunctionMethod("-")
|
|
|
public Float negative(Float f) {
|
|
public Float negative(Float f) {
|
|
|
return -f;
|
|
return -f;
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
@FunctionMethod("-")
|
|
@FunctionMethod("-")
|
|
|
public Integer minus(Integer i1, Integer i2) {
|
|
public Integer minus(Integer i1, Integer i2) {
|
|
|
return i1 - i2;
|
|
return i1 - i2;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
|
|
+ @FunctionMethod("-")
|
|
|
|
|
+ public Float minus(Integer i1, Float i2) {
|
|
|
|
|
+ return i1 - i2;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @FunctionMethod("-")
|
|
|
|
|
+ public Float minus(Float i1, Integer i2) {
|
|
|
|
|
+ return i1 - i2;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
@FunctionMethod("-")
|
|
@FunctionMethod("-")
|
|
|
public Float minus(Float i1, Float i2) {
|
|
public Float minus(Float i1, Float i2) {
|
|
|
return i1 - i2;
|
|
return i1 - i2;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
@FunctionMethod("*")
|
|
@FunctionMethod("*")
|
|
|
public Integer mul(Integer i1, Integer i2) {
|
|
public Integer mul(Integer i1, Integer i2) {
|
|
|
return i1 * i2;
|
|
return i1 * i2;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
|
|
+ @FunctionMethod("*")
|
|
|
|
|
+ public Float mul(Integer i1, Float i2) {
|
|
|
|
|
+ return i1 * i2;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @FunctionMethod("*")
|
|
|
|
|
+ public Float mul(Float i1, Integer i2) {
|
|
|
|
|
+ return i1 * i2;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
@FunctionMethod("*")
|
|
@FunctionMethod("*")
|
|
|
public Float mul(Float i1, Float i2) {
|
|
public Float mul(Float i1, Float i2) {
|
|
|
return i1 * i2;
|
|
return i1 * i2;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
@FunctionMethod("/")
|
|
@FunctionMethod("/")
|
|
|
public Integer div(Integer i1, Integer i2) {
|
|
public Integer div(Integer i1, Integer i2) {
|
|
|
return i1 / i2;
|
|
return i1 / i2;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
|
|
+ @FunctionMethod("/")
|
|
|
|
|
+ public Float div(Float i1, Integer i2) {
|
|
|
|
|
+ return i1 / i2;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @FunctionMethod("/")
|
|
|
|
|
+ public Float div(Integer i1, Float i2) {
|
|
|
|
|
+ return i1 / i2;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
@FunctionMethod("/")
|
|
@FunctionMethod("/")
|
|
|
public Float div(Float i1, Float i2) {
|
|
public Float div(Float i1, Float i2) {
|
|
|
return i1 / i2;
|
|
return i1 / i2;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
@FunctionMethod("%")
|
|
@FunctionMethod("%")
|
|
|
public Integer mod(Integer i1, Integer i2) {
|
|
public Integer mod(Integer i1, Integer i2) {
|
|
|
return i1 % i2;
|
|
return i1 % i2;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
|
|
+ @FunctionMethod("%")
|
|
|
|
|
+ public Float mod(Integer i1, Float i2) {
|
|
|
|
|
+ return i1 % i2;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @FunctionMethod("%")
|
|
|
|
|
+ public Float mod(Float i1, Integer i2) {
|
|
|
|
|
+ return i1 % i2;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
@FunctionMethod("%")
|
|
@FunctionMethod("%")
|
|
|
public Float mod(Float i1, Float i2) {
|
|
public Float mod(Float i1, Float i2) {
|
|
|
return i1 % i2;
|
|
return i1 % i2;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
@FunctionMethod("<<")
|
|
@FunctionMethod("<<")
|
|
|
public Integer left(Integer i1, Integer i2) {
|
|
public Integer left(Integer i1, Integer i2) {
|
|
|
return i1 << i2;
|
|
return i1 << i2;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
@FunctionMethod(">>")
|
|
@FunctionMethod(">>")
|
|
|
public Integer right(Integer i1, Integer i2) {
|
|
public Integer right(Integer i1, Integer i2) {
|
|
|
return i1 >> i2;
|
|
return i1 >> i2;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
@FunctionMethod("&")
|
|
@FunctionMethod("&")
|
|
|
public Integer bitwiseAnd(Integer i1, Integer i2) {
|
|
public Integer bitwiseAnd(Integer i1, Integer i2) {
|
|
|
return i1 & i2;
|
|
return i1 & i2;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
@FunctionMethod("|")
|
|
@FunctionMethod("|")
|
|
|
public Integer bitwiseOr(Integer i1, Integer i2) {
|
|
public Integer bitwiseOr(Integer i1, Integer i2) {
|
|
|
return i1 | i2;
|
|
return i1 | i2;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
@FunctionMethod("^")
|
|
@FunctionMethod("^")
|
|
|
public Integer bitwiseXor(Integer i1, Integer i2) {
|
|
public Integer bitwiseXor(Integer i1, Integer i2) {
|
|
|
return i1 ^ i2;
|
|
return i1 ^ i2;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
@FunctionMethod("^")
|
|
@FunctionMethod("^")
|
|
|
public Long bitwiseXor(Long l1, Long l2) {
|
|
public Long bitwiseXor(Long l1, Long l2) {
|
|
|
- return l1 ^ l2 ;
|
|
|
|
|
|
|
+ return l1 ^ l2;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
@FunctionMethod("==")
|
|
@FunctionMethod("==")
|
|
|
public Boolean equals(Boolean b1, Boolean b2) {
|
|
public Boolean equals(Boolean b1, Boolean b2) {
|
|
|
return b1.equals(b2);
|
|
return b1.equals(b2);
|
|
@@ -150,31 +196,71 @@ public class CoreFunction extends Function {
|
|
|
return i1.intValue() == i2.intValue();
|
|
return i1.intValue() == i2.intValue();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @FunctionMethod("==")
|
|
|
|
|
+ public Boolean equals(Float i1, Integer i2) {
|
|
|
|
|
+ return i1.intValue() == i2.intValue();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @FunctionMethod("==")
|
|
|
|
|
+ public Boolean equals(Integer i1, Float i2) {
|
|
|
|
|
+ return i1.intValue() == i2.intValue();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
@FunctionMethod("==")
|
|
@FunctionMethod("==")
|
|
|
public Boolean equals(Float i1, Float i2) {
|
|
public Boolean equals(Float i1, Float i2) {
|
|
|
return i1.floatValue() == i2.floatValue();
|
|
return i1.floatValue() == i2.floatValue();
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
|
|
+ @FunctionMethod("==")
|
|
|
|
|
+ public Boolean equals(String string1, String string2) {
|
|
|
|
|
+ return string1.equals(string2);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
@FunctionMethod("!=")
|
|
@FunctionMethod("!=")
|
|
|
public Boolean notEquals(Boolean b1, Boolean b2) {
|
|
public Boolean notEquals(Boolean b1, Boolean b2) {
|
|
|
return b1.booleanValue() != b2.booleanValue();
|
|
return b1.booleanValue() != b2.booleanValue();
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
@FunctionMethod("!=")
|
|
@FunctionMethod("!=")
|
|
|
public Boolean notEquals(Integer i1, Integer i2) {
|
|
public Boolean notEquals(Integer i1, Integer i2) {
|
|
|
return i1.intValue() != i2.intValue();
|
|
return i1.intValue() != i2.intValue();
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
|
|
+ @FunctionMethod("!=")
|
|
|
|
|
+ public Boolean notEquals(Integer i1, Float i2) {
|
|
|
|
|
+ return i1.intValue() != i2.intValue();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @FunctionMethod("!=")
|
|
|
|
|
+ public Boolean notEquals(Float i1, Integer i2) {
|
|
|
|
|
+ return i1.intValue() != i2.intValue();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
@FunctionMethod("!=")
|
|
@FunctionMethod("!=")
|
|
|
public Boolean notEquals(Float i1, Float i2) {
|
|
public Boolean notEquals(Float i1, Float i2) {
|
|
|
return i1.floatValue() != i2.floatValue();
|
|
return i1.floatValue() != i2.floatValue();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @FunctionMethod("!=")
|
|
|
|
|
+ public Boolean notEquals(String i1, String i2) {
|
|
|
|
|
+ return !i1.equals(i2);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
@FunctionMethod(">=")
|
|
@FunctionMethod(">=")
|
|
|
public Boolean greaterEqual(Integer i1, Integer i2) {
|
|
public Boolean greaterEqual(Integer i1, Integer i2) {
|
|
|
return i1 >= i2;
|
|
return i1 >= i2;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
|
|
+ @FunctionMethod(">=")
|
|
|
|
|
+ public Boolean greaterEqual(Integer i1, Float i2) {
|
|
|
|
|
+ return i1 >= i2;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @FunctionMethod(">=")
|
|
|
|
|
+ public Boolean greaterEqual(Float i1, Integer i2) {
|
|
|
|
|
+ return i1 >= i2;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
@FunctionMethod(">=")
|
|
@FunctionMethod(">=")
|
|
|
public Boolean greaterEqual(Float i1, Float i2) {
|
|
public Boolean greaterEqual(Float i1, Float i2) {
|
|
|
return i1 >= i2;
|
|
return i1 >= i2;
|
|
@@ -184,7 +270,17 @@ public class CoreFunction extends Function {
|
|
|
public Boolean smallerEqual(Integer i1, Integer i2) {
|
|
public Boolean smallerEqual(Integer i1, Integer i2) {
|
|
|
return i1 <= i2;
|
|
return i1 <= i2;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
|
|
+ @FunctionMethod("<=")
|
|
|
|
|
+ public Boolean smallerEqual(Integer i1, Float i2) {
|
|
|
|
|
+ return i1 <= i2;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @FunctionMethod("<=")
|
|
|
|
|
+ public Boolean smallerEqual(Float i1, Integer i2) {
|
|
|
|
|
+ return i1 <= i2;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
@FunctionMethod("<=")
|
|
@FunctionMethod("<=")
|
|
|
public Boolean smallerEqual(Float i1, Float i2) {
|
|
public Boolean smallerEqual(Float i1, Float i2) {
|
|
|
return i1 <= i2;
|
|
return i1 <= i2;
|
|
@@ -194,7 +290,17 @@ public class CoreFunction extends Function {
|
|
|
public Boolean greater(Integer i1, Integer i2) {
|
|
public Boolean greater(Integer i1, Integer i2) {
|
|
|
return i1 > i2;
|
|
return i1 > i2;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
|
|
+ @FunctionMethod(">")
|
|
|
|
|
+ public Boolean greater(Float i1, Integer i2) {
|
|
|
|
|
+ return i1 > i2;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @FunctionMethod(">")
|
|
|
|
|
+ public Boolean greater(Integer i1, Float i2) {
|
|
|
|
|
+ return i1 > i2;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
@FunctionMethod(">")
|
|
@FunctionMethod(">")
|
|
|
public Boolean greater(Float i1, Float i2) {
|
|
public Boolean greater(Float i1, Float i2) {
|
|
|
return i1 > i2;
|
|
return i1 > i2;
|
|
@@ -204,7 +310,17 @@ public class CoreFunction extends Function {
|
|
|
public Boolean smaller(Integer i1, Integer i2) {
|
|
public Boolean smaller(Integer i1, Integer i2) {
|
|
|
return i1 < i2;
|
|
return i1 < i2;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
|
|
+ @FunctionMethod("<")
|
|
|
|
|
+ public Boolean smaller(Integer i1, Float i2) {
|
|
|
|
|
+ return i1 < i2;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @FunctionMethod("<")
|
|
|
|
|
+ public Boolean smaller(Float i1, Integer i2) {
|
|
|
|
|
+ return i1 < i2;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
@FunctionMethod("<")
|
|
@FunctionMethod("<")
|
|
|
public Boolean smaller(Float i1, Float i2) {
|
|
public Boolean smaller(Float i1, Float i2) {
|
|
|
return i1 < i2;
|
|
return i1 < i2;
|
|
@@ -239,5 +355,4 @@ public class CoreFunction extends Function {
|
|
|
public Integer complement(Integer i) {
|
|
public Integer complement(Integer i) {
|
|
|
return ~i;
|
|
return ~i;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
}
|
|
}
|