use of org.yakindu.base.expressions.expressions.Expression in project statecharts by Yakindu.
the class ModelSequencerStateReactionTest method testAlwaysTriggerCondition.
/**
* The 'always' trigger event will be converted to a simple 'true'
* condition.
*/
@Test
public void testAlwaysTriggerCondition() {
ReactionTrigger tr1 = _createReactionTrigger(null);
_createAlwaysEventSpec(tr1);
Expression s = behaviorMapping.buildCondition(tr1);
assertNotNull(s);
assertTrue(s instanceof PrimitiveValueExpression);
assertBoolLiteral(true, ((PrimitiveValueExpression) s).getValue());
}
use of org.yakindu.base.expressions.expressions.Expression in project statecharts by Yakindu.
the class ModelSequencerStateReactionTest method testSingleRegularEventTriggerCondition.
/**
* Single trigger events of a Reaction Trigger will be converted into a
* single condition that consists of a ElementReferenceExpression to the
* corresponding event definition.
*/
@Test
public void testSingleRegularEventTriggerCondition() {
EventDefinition e1 = _createEventDefinition("e1", null);
ReactionTrigger tr1 = _createReactionTrigger(null);
_createRegularEventSpec(e1, tr1);
Expression s = behaviorMapping.buildCondition(tr1);
assertClass(ElementReferenceExpression.class, s);
}
use of org.yakindu.base.expressions.expressions.Expression in project statecharts by Yakindu.
the class STextJavaValidatorTest method checkAssignmentExpression.
/**
* @see STextJavaValidator#checkAssignmentExpression(org.yakindu.sct.model.stext.stext.AssignmentExpression)
*/
@Test
public void checkAssignmentExpression() {
String context = "interface: var i : integer = 42 var j : integer =23";
EObject expression = super.parseExpression("i += (i+=3) +4", Expression.class.getSimpleName(), context);
AssertableDiagnostics validationResult = tester.validate(expression);
validationResult.assertErrorContains(STextJavaValidator.ASSIGNMENT_EXPRESSION);
expression = super.parseExpression("i += (j+=3) +4", Expression.class.getSimpleName(), context);
validationResult = tester.validate(expression);
validationResult.assertOK();
}
use of org.yakindu.base.expressions.expressions.Expression in project statecharts by Yakindu.
the class ScheduleTimeEventImpl method basicSetTimeValue.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetTimeValue(Expression newTimeValue, NotificationChain msgs) {
Expression oldTimeValue = timeValue;
timeValue = newTimeValue;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, SexecPackage.SCHEDULE_TIME_EVENT__TIME_VALUE, oldTimeValue, newTimeValue);
if (msgs == null)
msgs = notification;
else
msgs.add(notification);
}
return msgs;
}
use of org.yakindu.base.expressions.expressions.Expression in project statecharts by Yakindu.
the class FeatureParameterValueImpl method basicSetExpression.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetExpression(Expression newExpression, NotificationChain msgs) {
Expression oldExpression = expression;
expression = newExpression;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, SGenPackage.FEATURE_PARAMETER_VALUE__EXPRESSION, oldExpression, newExpression);
if (msgs == null)
msgs = notification;
else
msgs.add(notification);
}
return msgs;
}
Aggregations