Search in sources :

Example 1 with ValueExpression

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

the class AssignmentActionImpl method basicSetValueExpression.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public NotificationChain basicSetValueExpression(ValueExpression newValueExpression, NotificationChain msgs) {
    ValueExpression oldValueExpression = valueExpression;
    valueExpression = newValueExpression;
    if (eNotificationRequired()) {
        ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, AadlBaPackage.ASSIGNMENT_ACTION__VALUE_EXPRESSION, oldValueExpression, newValueExpression);
        if (msgs == null)
            msgs = notification;
        else
            msgs.add(notification);
    }
    return msgs;
}
Also used : ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl) ValueExpression(org.osate.ba.aadlba.ValueExpression)

Example 2 with ValueExpression

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

the class WhileOrDoUntilStatementImpl method basicSetLogicalValueExpression.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public NotificationChain basicSetLogicalValueExpression(ValueExpression newLogicalValueExpression, NotificationChain msgs) {
    ValueExpression oldLogicalValueExpression = logicalValueExpression;
    logicalValueExpression = newLogicalValueExpression;
    if (eNotificationRequired()) {
        ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, AadlBaPackage.WHILE_OR_DO_UNTIL_STATEMENT__LOGICAL_VALUE_EXPRESSION, oldLogicalValueExpression, newLogicalValueExpression);
        if (msgs == null)
            msgs = notification;
        else
            msgs.add(notification);
    }
    return msgs;
}
Also used : ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl) ValueExpression(org.osate.ba.aadlba.ValueExpression)

Example 3 with ValueExpression

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

the class PortSendActionImpl method basicSetValueExpression.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public NotificationChain basicSetValueExpression(ValueExpression newValueExpression, NotificationChain msgs) {
    ValueExpression oldValueExpression = valueExpression;
    valueExpression = newValueExpression;
    if (eNotificationRequired()) {
        ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, AadlBaPackage.PORT_SEND_ACTION__VALUE_EXPRESSION, oldValueExpression, newValueExpression);
        if (msgs == null)
            msgs = notification;
        else
            msgs.add(notification);
    }
    return msgs;
}
Also used : ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl) ValueExpression(org.osate.ba.aadlba.ValueExpression)

Example 4 with ValueExpression

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

the class IfStatementImpl method basicSetLogicalValueExpression.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public NotificationChain basicSetLogicalValueExpression(ValueExpression newLogicalValueExpression, NotificationChain msgs) {
    ValueExpression oldLogicalValueExpression = logicalValueExpression;
    logicalValueExpression = newLogicalValueExpression;
    if (eNotificationRequired()) {
        ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, AadlBaPackage.IF_STATEMENT__LOGICAL_VALUE_EXPRESSION, oldLogicalValueExpression, newLogicalValueExpression);
        if (msgs == null)
            msgs = notification;
        else
            msgs.add(notification);
    }
    return msgs;
}
Also used : ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl) ValueExpression(org.osate.ba.aadlba.ValueExpression)

Example 5 with ValueExpression

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

the class AadlBaUtils method isOnlyOneValue.

/**
 * If the given value expression is composed of an single value, it returns
 * this value otherwise {@code null}. Recursive method.
 *
 * @param ve the given value expression
 * @return the value or {@code null}
 */
public static Value isOnlyOneValue(ValueExpression ve) {
    Relation firstRelation = ve.getRelations().get(0);
    SimpleExpression firstSE = firstRelation.getFirstExpression();
    Term firstTerm = firstSE.getTerms().get(0);
    Factor firstFactor = firstTerm.getFactors().get(0);
    Value firstValue = firstFactor.getFirstValue();
    if (ve.getRelations().size() == 1) {
        if (firstRelation.getSecondExpression() == null) {
            if (firstSE.getTerms().size() == 1) {
                if (firstTerm.getFactors().size() == 1) {
                    if (firstFactor.getSecondValue() == null) {
                        // Recursive case.
                        if (firstValue instanceof ValueExpression) {
                            return isOnlyOneValue((ValueExpression) firstValue);
                        } else {
                            return firstValue;
                        }
                    }
                }
            }
        }
    }
    return null;
}
Also used : Relation(org.osate.ba.aadlba.Relation) Factor(org.osate.ba.aadlba.Factor) ValueExpression(org.osate.ba.aadlba.ValueExpression) ListValue(org.osate.aadl2.ListValue) PortFreshValue(org.osate.ba.aadlba.PortFreshValue) IntegerValue(org.osate.ba.aadlba.IntegerValue) ClassifierValue(org.osate.aadl2.ClassifierValue) NamedValue(org.osate.aadl2.NamedValue) PortCountValue(org.osate.ba.aadlba.PortCountValue) ModalPropertyValue(org.osate.aadl2.ModalPropertyValue) Value(org.osate.ba.aadlba.Value) Term(org.osate.ba.aadlba.Term) SimpleExpression(org.osate.ba.aadlba.SimpleExpression)

Aggregations

ValueExpression (org.osate.ba.aadlba.ValueExpression)7 ENotificationImpl (org.eclipse.emf.ecore.impl.ENotificationImpl)4 NamedValue (org.osate.aadl2.NamedValue)2 BehaviorActionBlock (org.osate.ba.aadlba.BehaviorActionBlock)2 BehaviorTransition (org.osate.ba.aadlba.BehaviorTransition)2 DispatchCondition (org.osate.ba.aadlba.DispatchCondition)2 DeclarativeBehaviorTransition (org.osate.ba.declarative.DeclarativeBehaviorTransition)2 Iterator (java.util.Iterator)1 AbstractEnumerator (org.eclipse.emf.common.util.AbstractEnumerator)1 Enumerator (org.eclipse.emf.common.util.Enumerator)1 EObject (org.eclipse.emf.ecore.EObject)1 AbstractNamedValue (org.osate.aadl2.AbstractNamedValue)1 ArrayDimension (org.osate.aadl2.ArrayDimension)1 ClassifierValue (org.osate.aadl2.ClassifierValue)1 DataClassifier (org.osate.aadl2.DataClassifier)1 Element (org.osate.aadl2.Element)1 ListValue (org.osate.aadl2.ListValue)1 ModalPropertyValue (org.osate.aadl2.ModalPropertyValue)1 NamedElement (org.osate.aadl2.NamedElement)1 PropertyAssociation (org.osate.aadl2.PropertyAssociation)1