Search in sources :

Example 11 with Expression

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

the class GuardImpl 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, StextPackage.GUARD__EXPRESSION, oldExpression, newExpression);
        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 12 with Expression

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

the class RegularEventSpecImpl method basicSetEvent.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public NotificationChain basicSetEvent(Expression newEvent, NotificationChain msgs) {
    Expression oldEvent = event;
    event = newEvent;
    if (eNotificationRequired()) {
        ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, StextPackage.REGULAR_EVENT_SPEC__EVENT, oldEvent, newEvent);
        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 13 with Expression

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

the class RefactoringHelper method getAllActions.

/**
 * Collects all actions of the specified transitions and returns them.
 *
 * @param transitions
 * @return list of list of actions for the specified transitions
 */
public List<List<Expression>> getAllActions(List<Transition> transitions) {
    List<List<Expression>> allActions = new ArrayList<List<Expression>>();
    for (Transition transition : transitions) {
        Effect effect = transition.getEffect();
        if (effect instanceof ReactionEffect) {
            ReactionEffect reactionEffect = (ReactionEffect) effect;
            allActions.add(reactionEffect.getActions());
        } else {
            allActions.add(Collections.<Expression>emptyList());
        }
    }
    return allActions;
}
Also used : Expression(org.yakindu.base.expressions.expressions.Expression) ArrayList(java.util.ArrayList) Transition(org.yakindu.sct.model.sgraph.Transition) EList(org.eclipse.emf.common.util.EList) ArrayList(java.util.ArrayList) List(java.util.List) ReactionEffect(org.yakindu.sct.model.stext.stext.ReactionEffect) Effect(org.yakindu.sct.model.sgraph.Effect) ReactionEffect(org.yakindu.sct.model.stext.stext.ReactionEffect)

Example 14 with Expression

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

the class RefactoringHelper method hasAtLeastOneAction.

/**
 * Checks if the effect definition of a transition contains at least one action.
 *
 * @param transition
 * @return true if the condition is satisfied, false otherwise
 */
public boolean hasAtLeastOneAction(Transition transition) {
    Effect effect = transition.getEffect();
    if (effect instanceof ReactionEffect) {
        ReactionEffect reactionEffect = (ReactionEffect) effect;
        EList<Expression> actions = reactionEffect.getActions();
        return !actions.isEmpty();
    }
    return false;
}
Also used : Expression(org.yakindu.base.expressions.expressions.Expression) ReactionEffect(org.yakindu.sct.model.stext.stext.ReactionEffect) Effect(org.yakindu.sct.model.sgraph.Effect) ReactionEffect(org.yakindu.sct.model.stext.stext.ReactionEffect)

Example 15 with Expression

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

the class FoldOutgoingActionsRefactoring method getFirstActions.

private List<Expression> getFirstActions(Transition transition, int number) {
    List<Expression> firstActions = new ArrayList<Expression>();
    Effect effect = transition.getEffect();
    if (effect instanceof ReactionEffect) {
        ReactionEffect reactionEffect = (ReactionEffect) effect;
        List<Expression> actions = reactionEffect.getActions();
        for (int i = 0; i < number; i++) {
            firstActions.add(actions.get(i));
        }
    }
    return firstActions;
}
Also used : Expression(org.yakindu.base.expressions.expressions.Expression) ArrayList(java.util.ArrayList) ReactionEffect(org.yakindu.sct.model.stext.stext.ReactionEffect) Effect(org.yakindu.sct.model.sgraph.Effect) ReactionEffect(org.yakindu.sct.model.stext.stext.ReactionEffect)

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