Search in sources :

Example 6 with NamedElement

use of org.osate.aadl2.NamedElement in project AGREE by loonwerks.

the class AgreeASTBuilder method caseTimeRiseExpr.

@Override
public Expr caseTimeRiseExpr(TimeRiseExpr timeExpr) {
    NamedElement namedEl = timeExpr.getId();
    String idStr = namedEl.getName();
    AgreeVar var = timeRiseVarMap.get(idStr);
    if (var == null) {
        String varStr = idStr + AgreePatternTranslator.RISE_SUFFIX;
        var = new AgreeVar(varStr, NamedType.REAL, namedEl);
        timeRiseVarMap.put(idStr, var);
    }
    return new IdExpr(var.id);
}
Also used : IdExpr(jkind.lustre.IdExpr) NamedElement(org.osate.aadl2.NamedElement)

Example 7 with NamedElement

use of org.osate.aadl2.NamedElement in project AGREE by loonwerks.

the class AgreeASTBuilder method caseGetPropertyExpr.

@Override
public Expr caseGetPropertyExpr(GetPropertyExpr expr) {
    NamedElement propName = expr.getProp();
    PropertyExpression propVal;
    if (propName instanceof Property) {
        ComponentRef cr = expr.getComponentRef();
        NamedElement compName = null;
        if (cr instanceof DoubleDotRef) {
            compName = ((DoubleDotRef) cr).getElm();
        } else if (cr instanceof ThisRef) {
            compName = curInst;
        }
        Property prop = (Property) propName;
        propVal = AgreeUtils.getPropExpression(compName, prop);
        if (propVal == null) {
            if (Activator.getDefault().getPreferenceStore().getBoolean(PreferenceConstants.PREF_UNSPECIFIED_AADL_PROPERTIES)) {
                String propInputName = unspecifiedAadlPropertyPrefix + compName.getName() + dotChar + prop.getName();
                unspecifiedAadlProperties.put(propInputName, expr);
                return new IdExpr(propInputName);
            } else {
                throw new AgreeException("Could not locate property value '" + prop.getQualifiedName() + "' in component '" + compName.getName() + "'.  Is it possible " + "that a 'this' statement is used in a context in which it wasn't supposed to?" + "  Analysis of unspecified AADL properties as inputs may be enabled in the AGREE preferences.");
            }
        }
    } else {
        propVal = AgreeUtils.getPropExpression((PropertyConstant) propName);
        if (propVal == null) {
            throw new AgreeException("Could not locate property value '" + propName.getQualifiedName());
        }
    }
    Expr res = null;
    if (propVal != null) {
        if (propVal instanceof StringLiteral) {
            // nodeStr += value.getValue() + ")";
            throw new AgreeException("Property value for '" + propName.getQualifiedName() + "' cannot be of string type");
        } else if (propVal instanceof NamedValue) {
            // EnumerationLiteral enVal = (EnumerationLiteral) absVal;
            throw new AgreeException("Property value for '" + propName.getQualifiedName() + "' cannot be of enumeration type");
        } else if (propVal instanceof BooleanLiteral) {
            BooleanLiteral value = (BooleanLiteral) propVal;
            res = new BoolExpr(value.getValue());
        } else if (propVal instanceof IntegerLiteral) {
            IntegerLiteral value = (IntegerLiteral) propVal;
            res = new IntExpr(BigInteger.valueOf((long) value.getScaledValue()));
        } else {
            assert (propVal instanceof RealLiteral);
            RealLiteral value = (RealLiteral) propVal;
            res = new RealExpr(BigDecimal.valueOf(value.getValue()));
        }
    }
    assert (res != null);
    return res;
}
Also used : BoolExpr(jkind.lustre.BoolExpr) IdExpr(jkind.lustre.IdExpr) BooleanLiteral(org.osate.aadl2.BooleanLiteral) NamedValue(org.osate.aadl2.NamedValue) PropertyConstant(org.osate.aadl2.PropertyConstant) RealLiteral(org.osate.aadl2.RealLiteral) EnumLitExpr(com.rockwellcollins.atc.agree.agree.EnumLitExpr) IndicesExpr(com.rockwellcollins.atc.agree.agree.IndicesExpr) TimeRiseExpr(com.rockwellcollins.atc.agree.agree.TimeRiseExpr) RecordAccessExpr(jkind.lustre.RecordAccessExpr) FlatmapExpr(com.rockwellcollins.atc.agree.agree.FlatmapExpr) TimeFallExpr(com.rockwellcollins.atc.agree.agree.TimeFallExpr) RealLitExpr(com.rockwellcollins.atc.agree.agree.RealLitExpr) GetPropertyExpr(com.rockwellcollins.atc.agree.agree.GetPropertyExpr) Expr(jkind.lustre.Expr) CastExpr(jkind.lustre.CastExpr) NodeCallExpr(jkind.lustre.NodeCallExpr) TimeOfExpr(com.rockwellcollins.atc.agree.agree.TimeOfExpr) BoolExpr(jkind.lustre.BoolExpr) BinaryExpr(jkind.lustre.BinaryExpr) RealExpr(jkind.lustre.RealExpr) ArrayExpr(jkind.lustre.ArrayExpr) PrevExpr(com.rockwellcollins.atc.agree.agree.PrevExpr) IdExpr(jkind.lustre.IdExpr) TimeExpr(com.rockwellcollins.atc.agree.agree.TimeExpr) FoldRightExpr(com.rockwellcollins.atc.agree.agree.FoldRightExpr) TagExpr(com.rockwellcollins.atc.agree.agree.TagExpr) EventExpr(com.rockwellcollins.atc.agree.agree.EventExpr) LatchedExpr(com.rockwellcollins.atc.agree.agree.LatchedExpr) NamedElmExpr(com.rockwellcollins.atc.agree.agree.NamedElmExpr) FunctionCallExpr(jkind.lustre.FunctionCallExpr) SelectionExpr(com.rockwellcollins.atc.agree.agree.SelectionExpr) IfThenElseExpr(jkind.lustre.IfThenElseExpr) TupleExpr(jkind.lustre.TupleExpr) UnaryExpr(jkind.lustre.UnaryExpr) ArraySubExpr(com.rockwellcollins.atc.agree.agree.ArraySubExpr) IntExpr(jkind.lustre.IntExpr) PreExpr(com.rockwellcollins.atc.agree.agree.PreExpr) RecordLitExpr(com.rockwellcollins.atc.agree.agree.RecordLitExpr) ExistsExpr(com.rockwellcollins.atc.agree.agree.ExistsExpr) FoldLeftExpr(com.rockwellcollins.atc.agree.agree.FoldLeftExpr) RecordUpdateExpr(com.rockwellcollins.atc.agree.agree.RecordUpdateExpr) ForallExpr(com.rockwellcollins.atc.agree.agree.ForallExpr) ArrayAccessExpr(jkind.lustre.ArrayAccessExpr) ArrayUpdateExpr(com.rockwellcollins.atc.agree.agree.ArrayUpdateExpr) BoolLitExpr(com.rockwellcollins.atc.agree.agree.BoolLitExpr) NodeBodyExpr(com.rockwellcollins.atc.agree.agree.NodeBodyExpr) IntLitExpr(com.rockwellcollins.atc.agree.agree.IntLitExpr) CallExpr(com.rockwellcollins.atc.agree.agree.CallExpr) ArrayLiteralExpr(com.rockwellcollins.atc.agree.agree.ArrayLiteralExpr) StringLiteral(org.osate.aadl2.StringLiteral) ThisRef(com.rockwellcollins.atc.agree.agree.ThisRef) DoubleDotRef(com.rockwellcollins.atc.agree.agree.DoubleDotRef) PropertyExpression(org.osate.aadl2.PropertyExpression) AgreeException(com.rockwellcollins.atc.agree.analysis.AgreeException) IntExpr(jkind.lustre.IntExpr) ComponentRef(com.rockwellcollins.atc.agree.agree.ComponentRef) NamedElement(org.osate.aadl2.NamedElement) Property(org.osate.aadl2.Property) RealExpr(jkind.lustre.RealExpr) IntegerLiteral(org.osate.aadl2.IntegerLiteral)

Example 8 with NamedElement

use of org.osate.aadl2.NamedElement in project AGREE by loonwerks.

the class GetPropertyExprImpl method setProp.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public void setProp(NamedElement newProp) {
    NamedElement oldProp = prop;
    prop = newProp;
    if (eNotificationRequired())
        eNotify(new ENotificationImpl(this, Notification.SET, AgreePackage.GET_PROPERTY_EXPR__PROP, oldProp, prop));
}
Also used : ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl) NamedElement(org.osate.aadl2.NamedElement)

Example 9 with NamedElement

use of org.osate.aadl2.NamedElement in project AGREE by loonwerks.

the class RecordUpdateExprImpl method setKey.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public void setKey(NamedElement newKey) {
    NamedElement oldKey = key;
    key = newKey;
    if (eNotificationRequired())
        eNotify(new ENotificationImpl(this, Notification.SET, AgreePackage.RECORD_UPDATE_EXPR__KEY, oldKey, key));
}
Also used : ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl) NamedElement(org.osate.aadl2.NamedElement)

Example 10 with NamedElement

use of org.osate.aadl2.NamedElement in project AGREE by loonwerks.

the class TimeRiseExprImpl method setId.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public void setId(NamedElement newId) {
    NamedElement oldId = id;
    id = newId;
    if (eNotificationRequired())
        eNotify(new ENotificationImpl(this, Notification.SET, AgreePackage.TIME_RISE_EXPR__ID, oldId, id));
}
Also used : ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl) NamedElement(org.osate.aadl2.NamedElement)

Aggregations

Property (org.osate.aadl2.Property)351 PropertyExpression (org.osate.aadl2.PropertyExpression)291 PropertyNotPresentException (org.osate.aadl2.properties.PropertyNotPresentException)236 NamedElement (org.osate.aadl2.NamedElement)229 BasicProperty (org.osate.aadl2.BasicProperty)90 ListValue (org.osate.aadl2.ListValue)63 EObject (org.eclipse.emf.ecore.EObject)50 UnitLiteral (org.osate.aadl2.UnitLiteral)48 Classifier (org.osate.aadl2.Classifier)46 ArrayList (java.util.ArrayList)45 TimeUnits (org.osate.aadl2.contrib.aadlproject.TimeUnits)41 PropertyAssociation (org.osate.aadl2.PropertyAssociation)38 ComponentClassifier (org.osate.aadl2.ComponentClassifier)37 Subcomponent (org.osate.aadl2.Subcomponent)35 ENotificationImpl (org.eclipse.emf.ecore.impl.ENotificationImpl)32 BasicPropertyAssociation (org.osate.aadl2.BasicPropertyAssociation)32 ContainedNamedElement (org.osate.aadl2.ContainedNamedElement)31 ComponentImplementation (org.osate.aadl2.ComponentImplementation)30 ContainmentPathElement (org.osate.aadl2.ContainmentPathElement)28 Element (org.osate.aadl2.Element)28