use of org.yakindu.base.expressions.expressions.IntLiteral in project statecharts by Yakindu.
the class StextTestFactory method _createValue.
public static PrimitiveValueExpression _createValue(int i) {
PrimitiveValueExpression assignment = ExpressionsFactory.eINSTANCE.createPrimitiveValueExpression();
IntLiteral intLit = ExpressionsFactory.eINSTANCE.createIntLiteral();
intLit.setValue(i);
assignment.setValue(intLit);
return assignment;
}
use of org.yakindu.base.expressions.expressions.IntLiteral 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.IntLiteral in project statecharts by Yakindu.
the class SCTResourceTest method testTransitionSerializing.
@Test
public void testTransitionSerializing() throws Exception {
res.setSerializerEnabled(true);
Transition transition = createTransition("after 10\n s [true] / 3 * 3");
res.getContents().add(transition);
ReactionTrigger trigger = (ReactionTrigger) transition.getTrigger();
TimeEventSpec timeTrigger = stextFac.createTimeEventSpec();
timeTrigger.setType(TimeEventType.EVERY);
timeTrigger.setUnit(TimeUnit.SECOND);
PrimitiveValueExpression exp = expFac.createPrimitiveValueExpression();
IntLiteral literal = expFac.createIntLiteral();
literal.setValue(42);
exp.setValue(literal);
timeTrigger.setValue(exp);
trigger.getTriggers().add(timeTrigger);
assertEquals("after 10\n s , every 42 s [true] / 3 * 3", transition.getSpecification());
assertEquals("" + res.getErrors(), 0, res.getErrors().size());
}
use of org.yakindu.base.expressions.expressions.IntLiteral in project statecharts by Yakindu.
the class FeatureParameterValueImpl method setValue.
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated NOT
*/
@Override
public void setValue(int bool) {
IntLiteral intLiteral = ExpressionsFactory.eINSTANCE.createIntLiteral();
intLiteral.setValue(bool);
setValue(intLiteral);
}
Aggregations