Search in sources :

Example 1 with NamedID

use of com.rockwellcollins.atc.agree.agree.NamedID in project AGREE by loonwerks.

the class AgreeASTBuilder method caseExistsExpr.

@Override
public Expr caseExistsExpr(ExistsExpr expr) {
    com.rockwellcollins.atc.agree.agree.Expr arrayExpr = expr.getArray();
    Expr array = doSwitch(arrayExpr);
    AgreeTypeSystem.TypeDef agreeType = AgreeTypeSystem.infer(arrayExpr);
    int size = 0;
    if (agreeType instanceof AgreeTypeSystem.ArrayTypeDef) {
        size = ((AgreeTypeSystem.ArrayTypeDef) agreeType).size;
    } else {
        throw new AgreeException("ERROR: caseExistsExpr - '" + agreeType.getClass() + "' not handled");
    }
    NamedID binding = expr.getBinding();
    Expr final_expr = new BoolExpr(false);
    for (int i = 0; i < size; ++i) {
        Expr arrayAccess = new ArrayAccessExpr(array, i);
        Expr body = doSwitch(expr.getExpr()).accept(new SubstitutionVisitor(binding.getName(), arrayAccess));
        final_expr = LustreExprFactory.makeORExpr(final_expr, body);
    }
    return final_expr;
}
Also used : BoolExpr(jkind.lustre.BoolExpr) ArrayAccessExpr(jkind.lustre.ArrayAccessExpr) NamedID(com.rockwellcollins.atc.agree.agree.NamedID) AgreeTypeSystem(com.rockwellcollins.atc.agree.AgreeTypeSystem) SubstitutionVisitor(jkind.translation.SubstitutionVisitor) 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) AgreeException(com.rockwellcollins.atc.agree.analysis.AgreeException)

Example 2 with NamedID

use of com.rockwellcollins.atc.agree.agree.NamedID in project AGREE by loonwerks.

the class FoldRightExprImpl method basicSetAccumulator.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public NotificationChain basicSetAccumulator(NamedID newAccumulator, NotificationChain msgs) {
    NamedID oldAccumulator = accumulator;
    accumulator = newAccumulator;
    if (eNotificationRequired()) {
        ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, AgreePackage.FOLD_RIGHT_EXPR__ACCUMULATOR, oldAccumulator, newAccumulator);
        if (msgs == null)
            msgs = notification;
        else
            msgs.add(notification);
    }
    return msgs;
}
Also used : ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl) NamedID(com.rockwellcollins.atc.agree.agree.NamedID)

Example 3 with NamedID

use of com.rockwellcollins.atc.agree.agree.NamedID in project AGREE by loonwerks.

the class ForallExprImpl method basicSetBinding.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public NotificationChain basicSetBinding(NamedID newBinding, NotificationChain msgs) {
    NamedID oldBinding = binding;
    binding = newBinding;
    if (eNotificationRequired()) {
        ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, AgreePackage.FORALL_EXPR__BINDING, oldBinding, newBinding);
        if (msgs == null)
            msgs = notification;
        else
            msgs.add(notification);
    }
    return msgs;
}
Also used : ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl) NamedID(com.rockwellcollins.atc.agree.agree.NamedID)

Example 4 with NamedID

use of com.rockwellcollins.atc.agree.agree.NamedID in project AGREE by loonwerks.

the class ExistsExprImpl method basicSetBinding.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public NotificationChain basicSetBinding(NamedID newBinding, NotificationChain msgs) {
    NamedID oldBinding = binding;
    binding = newBinding;
    if (eNotificationRequired()) {
        ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, AgreePackage.EXISTS_EXPR__BINDING, oldBinding, newBinding);
        if (msgs == null)
            msgs = notification;
        else
            msgs.add(notification);
    }
    return msgs;
}
Also used : ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl) NamedID(com.rockwellcollins.atc.agree.agree.NamedID)

Example 5 with NamedID

use of com.rockwellcollins.atc.agree.agree.NamedID in project AGREE by loonwerks.

the class FlatmapExprImpl method basicSetBinding.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public NotificationChain basicSetBinding(NamedID newBinding, NotificationChain msgs) {
    NamedID oldBinding = binding;
    binding = newBinding;
    if (eNotificationRequired()) {
        ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, AgreePackage.FLATMAP_EXPR__BINDING, oldBinding, newBinding);
        if (msgs == null)
            msgs = notification;
        else
            msgs.add(notification);
    }
    return msgs;
}
Also used : ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl) NamedID(com.rockwellcollins.atc.agree.agree.NamedID)

Aggregations

NamedID (com.rockwellcollins.atc.agree.agree.NamedID)17 NamedElmExpr (com.rockwellcollins.atc.agree.agree.NamedElmExpr)6 SelectionExpr (com.rockwellcollins.atc.agree.agree.SelectionExpr)6 ENotificationImpl (org.eclipse.emf.ecore.impl.ENotificationImpl)6 AgreeTypeSystem (com.rockwellcollins.atc.agree.AgreeTypeSystem)5 ArrayLiteralExpr (com.rockwellcollins.atc.agree.agree.ArrayLiteralExpr)5 ArraySubExpr (com.rockwellcollins.atc.agree.agree.ArraySubExpr)5 ArrayUpdateExpr (com.rockwellcollins.atc.agree.agree.ArrayUpdateExpr)5 BoolLitExpr (com.rockwellcollins.atc.agree.agree.BoolLitExpr)5 CallExpr (com.rockwellcollins.atc.agree.agree.CallExpr)5 EnumLitExpr (com.rockwellcollins.atc.agree.agree.EnumLitExpr)5 EventExpr (com.rockwellcollins.atc.agree.agree.EventExpr)5 ExistsExpr (com.rockwellcollins.atc.agree.agree.ExistsExpr)5 FlatmapExpr (com.rockwellcollins.atc.agree.agree.FlatmapExpr)5 FoldLeftExpr (com.rockwellcollins.atc.agree.agree.FoldLeftExpr)5 FoldRightExpr (com.rockwellcollins.atc.agree.agree.FoldRightExpr)5 ForallExpr (com.rockwellcollins.atc.agree.agree.ForallExpr)5 GetPropertyExpr (com.rockwellcollins.atc.agree.agree.GetPropertyExpr)5 IndicesExpr (com.rockwellcollins.atc.agree.agree.IndicesExpr)5 IntLitExpr (com.rockwellcollins.atc.agree.agree.IntLitExpr)5