Search in sources :

Example 1 with BehaviorCondition

use of org.osate.ba.aadlba.BehaviorCondition in project osate2 by osate.

the class BehaviorTransitionImpl method basicSetCondition.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public NotificationChain basicSetCondition(BehaviorCondition newCondition, NotificationChain msgs) {
    BehaviorCondition oldCondition = condition;
    condition = newCondition;
    if (eNotificationRequired()) {
        ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, AadlBaPackage.BEHAVIOR_TRANSITION__CONDITION, oldCondition, newCondition);
        if (msgs == null)
            msgs = notification;
        else
            msgs.add(notification);
    }
    return msgs;
}
Also used : BehaviorCondition(org.osate.ba.aadlba.BehaviorCondition) ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl)

Example 2 with BehaviorCondition

use of org.osate.ba.aadlba.BehaviorCondition in project osate2 by osate.

the class AadlBaNameResolver method behaviorTransitionResolver.

/**
 * Document: AADL Behavior Annex draft
 * Version : 0.94
 * Type : Naming rule
 * Section : D.3 Behavior Specification
 * Object : Check naming rule D.3.(N2)
 * Keys : empty execution condition
 *
 * Resolves the names in behavior annex's transitions.
 *
 * @return {@code true} if all names are resolved. {@code false} otherwise.
 */
private boolean behaviorTransitionResolver() {
    boolean result = true;
    for (BehaviorTransition tmp : _ba.getTransitions()) {
        DeclarativeBehaviorTransition trans = (DeclarativeBehaviorTransition) tmp;
        result &= transDestStateResolver(trans);
        result &= transSrcStateResolver(trans);
        BehaviorCondition cond = trans.getCondition();
        // as no condition means always true.
        if (cond != null) {
            // Case of a dispatch condition
            if (cond instanceof DispatchCondition) {
                result &= dispatchConditionResolver((DispatchCondition) cond);
            } else // Case of mode switch condition
            if (cond instanceof ModeSwitchTriggerLogicalExpression) {
                result &= modeSwitchTriggerLogicalExpression((ModeSwitchTriggerLogicalExpression) cond);
            } else // ModeSwitchTriggerLogicalExpression
            // Case of a execute condition
            {
                if (cond instanceof ValueExpression) {
                    result &= valueExpressionResolver((ValueExpression) cond);
                }
            }
        }
        BehaviorActionBlock block = trans.getActionBlock();
        // Behavior actions of an behavior transition may not exist.
        if (block != null) {
            result &= behaviorActionBlockResolver(block);
        }
    }
    return result;
}
Also used : DispatchCondition(org.osate.ba.aadlba.DispatchCondition) ModeSwitchTriggerLogicalExpression(org.osate.ba.aadlba.ModeSwitchTriggerLogicalExpression) DeclarativeBehaviorTransition(org.osate.ba.declarative.DeclarativeBehaviorTransition) BehaviorCondition(org.osate.ba.aadlba.BehaviorCondition) ValueExpression(org.osate.ba.aadlba.ValueExpression) BehaviorActionBlock(org.osate.ba.aadlba.BehaviorActionBlock) BehaviorTransition(org.osate.ba.aadlba.BehaviorTransition) DeclarativeBehaviorTransition(org.osate.ba.declarative.DeclarativeBehaviorTransition)

Example 3 with BehaviorCondition

use of org.osate.ba.aadlba.BehaviorCondition in project osate2 by osate.

the class BehaviorTransitionEmbeddedTextUtil method getConditionOffset.

private static int getConditionOffset(final BehaviorTransition behaviorTransition, final String sourceText) {
    final BehaviorCondition condition = behaviorTransition.getCondition();
    final int conditionOffset;
    if (condition == null) {
        // Transition offset
        final int transitionOffset = behaviorTransition.getAadlBaLocationReference().getOffset();
        final Pair<Character, Character> charsToMatch = new Pair<Character, Character>('-', '[');
        // Find index for beginning of condition text "-["
        conditionOffset = BehaviorAnnexXtextUtil.findUncommentedCharPair(sourceText.substring(transitionOffset), charsToMatch) + transitionOffset;
    } else {
        // Condition offset
        conditionOffset = condition.getAadlBaLocationReference().getOffset();
    }
    return conditionOffset;
}
Also used : BehaviorCondition(org.osate.ba.aadlba.BehaviorCondition) Pair(org.eclipse.xtext.xbase.lib.Pair)

Aggregations

BehaviorCondition (org.osate.ba.aadlba.BehaviorCondition)3 ENotificationImpl (org.eclipse.emf.ecore.impl.ENotificationImpl)1 Pair (org.eclipse.xtext.xbase.lib.Pair)1 BehaviorActionBlock (org.osate.ba.aadlba.BehaviorActionBlock)1 BehaviorTransition (org.osate.ba.aadlba.BehaviorTransition)1 DispatchCondition (org.osate.ba.aadlba.DispatchCondition)1 ModeSwitchTriggerLogicalExpression (org.osate.ba.aadlba.ModeSwitchTriggerLogicalExpression)1 ValueExpression (org.osate.ba.aadlba.ValueExpression)1 DeclarativeBehaviorTransition (org.osate.ba.declarative.DeclarativeBehaviorTransition)1