Search in sources :

Example 26 with Expression

use of org.yakindu.base.expressions.expressions.Expression in project statecharts by Yakindu.

the class PropertyDefinitionImpl method basicSetInitialValue.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public NotificationChain basicSetInitialValue(Expression newInitialValue, NotificationChain msgs) {
    Expression oldInitialValue = initialValue;
    initialValue = newInitialValue;
    if (eNotificationRequired()) {
        ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, SGenPackage.PROPERTY_DEFINITION__INITIAL_VALUE, oldInitialValue, newInitialValue);
        if (msgs == null)
            msgs = notification;
        else
            msgs.add(notification);
    }
    return msgs;
}
Also used : Expression(org.yakindu.base.expressions.expressions.Expression) ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl)

Example 27 with Expression

use of org.yakindu.base.expressions.expressions.Expression in project statecharts by Yakindu.

the class ExecutionImpl method basicSetStatement.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public NotificationChain basicSetStatement(Expression newStatement, NotificationChain msgs) {
    Expression oldStatement = statement;
    statement = newStatement;
    if (eNotificationRequired()) {
        ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, SexecPackage.EXECUTION__STATEMENT, oldStatement, newStatement);
        if (msgs == null)
            msgs = notification;
        else
            msgs.add(notification);
    }
    return msgs;
}
Also used : Expression(org.yakindu.base.expressions.expressions.Expression) ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl)

Example 28 with Expression

use of org.yakindu.base.expressions.expressions.Expression in project statecharts by Yakindu.

the class StatechartObjectViewerFilter method select.

@Override
public boolean select(Viewer viewer, Object parentElement, Object element) {
    if (element instanceof DomainNavigatorItem) {
        DomainNavigatorItem navigatorItem = (DomainNavigatorItem) element;
        EObject modelElement = navigatorItem.getEObject();
        if (modelElement instanceof Diagram) {
            return false;
        }
        if (modelElement instanceof Trigger) {
            return false;
        }
        if (modelElement instanceof InternalScope || modelElement instanceof InterfaceScope) {
            return true;
        }
        if (modelElement instanceof Scope) {
            return false;
        }
        if (modelElement instanceof LocalReaction) {
            return false;
        }
        if (modelElement instanceof ReactionEffect) {
            return false;
        }
        if (modelElement instanceof Expression) {
            return false;
        }
    }
    return true;
}
Also used : LocalReaction(org.yakindu.sct.model.stext.stext.LocalReaction) Trigger(org.yakindu.sct.model.sgraph.Trigger) Scope(org.yakindu.sct.model.sgraph.Scope) InterfaceScope(org.yakindu.sct.model.stext.stext.InterfaceScope) InternalScope(org.yakindu.sct.model.stext.stext.InternalScope) Expression(org.yakindu.base.expressions.expressions.Expression) EObject(org.eclipse.emf.ecore.EObject) InternalScope(org.yakindu.sct.model.stext.stext.InternalScope) InterfaceScope(org.yakindu.sct.model.stext.stext.InterfaceScope) ReactionEffect(org.yakindu.sct.model.stext.stext.ReactionEffect) Diagram(org.eclipse.gmf.runtime.notation.Diagram)

Example 29 with Expression

use of org.yakindu.base.expressions.expressions.Expression in project statecharts by Yakindu.

the class ModelSequencerStateReactionTest method testMultipleRegularEventTriggerCondition.

/**
 * Multiple trigger events of a ReactionTrigger will be converted to a
 * condition that consists of a ElementReferenceExpressions connected by
 * LogicalOrExpressions.
 *
 * e1, e1 -> e1 || e2
 */
@Test
public void testMultipleRegularEventTriggerCondition() {
    EventDefinition e1 = _createEventDefinition("e1", null);
    EventDefinition e2 = _createEventDefinition("e2", null);
    ReactionTrigger tr1 = _createReactionTrigger(null);
    _createRegularEventSpec(e1, tr1);
    _createRegularEventSpec(e2, tr1);
    Expression s = behaviorMapping.buildCondition(tr1);
    assertTrue(s instanceof LogicalOrExpression);
    assertClass(ElementReferenceExpression.class, ((LogicalOrExpression) s).getLeftOperand());
    assertClass(ElementReferenceExpression.class, ((LogicalOrExpression) s).getRightOperand());
}
Also used : StextTestFactory._createReactionTrigger(org.yakindu.sct.model.stext.test.util.StextTestFactory._createReactionTrigger) ReactionTrigger(org.yakindu.sct.model.stext.stext.ReactionTrigger) LogicalAndExpression(org.yakindu.base.expressions.expressions.LogicalAndExpression) AssignmentExpression(org.yakindu.base.expressions.expressions.AssignmentExpression) LogicalOrExpression(org.yakindu.base.expressions.expressions.LogicalOrExpression) NumericalMultiplyDivideExpression(org.yakindu.base.expressions.expressions.NumericalMultiplyDivideExpression) ElementReferenceExpression(org.yakindu.base.expressions.expressions.ElementReferenceExpression) StextTestFactory.createGuardExpression(org.yakindu.sct.model.stext.test.util.StextTestFactory.createGuardExpression) Expression(org.yakindu.base.expressions.expressions.Expression) ParenthesizedExpression(org.yakindu.base.expressions.expressions.ParenthesizedExpression) PrimitiveValueExpression(org.yakindu.base.expressions.expressions.PrimitiveValueExpression) LogicalOrExpression(org.yakindu.base.expressions.expressions.LogicalOrExpression) StextTestFactory._createEventDefinition(org.yakindu.sct.model.stext.test.util.StextTestFactory._createEventDefinition) EventDefinition(org.yakindu.sct.model.stext.stext.EventDefinition) Test(org.junit.Test)

Example 30 with Expression

use of org.yakindu.base.expressions.expressions.Expression in project statecharts by Yakindu.

the class Assert method assertAssignment.

public static void assertAssignment(Step step, String variableName, AssignmentOperator operator, String value) {
    assertClass(Execution.class, step);
    Execution exec = (Execution) step;
    assertTrue(exec.getStatement() instanceof AssignmentExpression);
    AssignmentExpression assignment = (AssignmentExpression) exec.getStatement();
    assertEquals(operator, assignment.getOperator());
    Expression varRef = assignment.getVarRef();
    if (varRef instanceof ElementReferenceExpression) {
        ElementReferenceExpression elementRef = (ElementReferenceExpression) varRef;
        assertEquals(variableName, ((NamedElement) elementRef.getReference()).getName());
    } else if (varRef instanceof FeatureCall) {
        FeatureCall call = (FeatureCall) varRef;
        assertEquals(variableName, ((NamedElement) call.getFeature()).getName());
    }
    assertExpressionEquals(value, assignment.getExpression());
}
Also used : Execution(org.yakindu.sct.model.sexec.Execution) AssignmentExpression(org.yakindu.base.expressions.expressions.AssignmentExpression) AssignmentExpression(org.yakindu.base.expressions.expressions.AssignmentExpression) Expression(org.yakindu.base.expressions.expressions.Expression) PrimitiveValueExpression(org.yakindu.base.expressions.expressions.PrimitiveValueExpression) ElementReferenceExpression(org.yakindu.base.expressions.expressions.ElementReferenceExpression) ElementReferenceExpression(org.yakindu.base.expressions.expressions.ElementReferenceExpression) FeatureCall(org.yakindu.base.expressions.expressions.FeatureCall) NamedElement(org.yakindu.base.base.NamedElement)

Aggregations

Expression (org.yakindu.base.expressions.expressions.Expression)48 ENotificationImpl (org.eclipse.emf.ecore.impl.ENotificationImpl)24 AssignmentExpression (org.yakindu.base.expressions.expressions.AssignmentExpression)11 ElementReferenceExpression (org.yakindu.base.expressions.expressions.ElementReferenceExpression)10 ReactionEffect (org.yakindu.sct.model.stext.stext.ReactionEffect)9 EObject (org.eclipse.emf.ecore.EObject)7 FeatureCall (org.yakindu.base.expressions.expressions.FeatureCall)6 PrimitiveValueExpression (org.yakindu.base.expressions.expressions.PrimitiveValueExpression)6 Effect (org.yakindu.sct.model.sgraph.Effect)6 ArrayList (java.util.ArrayList)5 ParenthesizedExpression (org.yakindu.base.expressions.expressions.ParenthesizedExpression)5 PostFixUnaryExpression (org.yakindu.base.expressions.expressions.PostFixUnaryExpression)5 ReactionTrigger (org.yakindu.sct.model.stext.stext.ReactionTrigger)5 Test (org.junit.Test)4 ConditionalExpression (org.yakindu.base.expressions.expressions.ConditionalExpression)4 LogicalAndExpression (org.yakindu.base.expressions.expressions.LogicalAndExpression)4 LogicalOrExpression (org.yakindu.base.expressions.expressions.LogicalOrExpression)4 NumericalMultiplyDivideExpression (org.yakindu.base.expressions.expressions.NumericalMultiplyDivideExpression)4 Scope (org.yakindu.sct.model.sgraph.Scope)4 Transition (org.yakindu.sct.model.sgraph.Transition)4