use of org.yakindu.base.expressions.expressions.Literal in project statecharts by Yakindu.
the class Assert method assertExpressionEquals.
public static void assertExpressionEquals(String expected, Expression current) {
String currentValue = null;
if (current instanceof PrimitiveValueExpression) {
Literal literal = ((PrimitiveValueExpression) current).getValue();
if (literal instanceof BoolLiteral) {
currentValue = Boolean.toString(((BoolLiteral) literal).isValue());
} else if (literal instanceof IntLiteral) {
currentValue = Long.toString(((IntLiteral) literal).getValue());
} else if (literal instanceof DoubleLiteral) {
currentValue = Double.toString(((DoubleLiteral) literal).getValue());
} else if (literal instanceof FloatLiteral) {
currentValue = Double.toString(((FloatLiteral) literal).getValue());
} else if (literal instanceof StringLiteral) {
currentValue = (((StringLiteral) literal).getValue());
}
}
assertEquals(expected, currentValue);
}
use of org.yakindu.base.expressions.expressions.Literal in project statecharts by Yakindu.
the class PrimitiveValueExpressionImpl method basicSetValue.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetValue(Literal newValue, NotificationChain msgs) {
Literal oldValue = value;
value = newValue;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ExpressionsPackage.PRIMITIVE_VALUE_EXPRESSION__VALUE, oldValue, newValue);
if (msgs == null)
msgs = notification;
else
msgs.add(notification);
}
return msgs;
}
Aggregations