Search in sources :

Example 1 with PatternStatement

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

the class AgreeASTBuilder method getGuaranteeStatements.

private List<AgreeStatement> getGuaranteeStatements(EList<SpecStatement> specs, Map<String, jkind.lustre.Expr> rewriteMap) {
    List<AgreeStatement> guarantees = new ArrayList<>();
    for (SpecStatement spec : specs) {
        if (spec instanceof GuaranteeStatement) {
            GuaranteeStatement guarantee = (GuaranteeStatement) spec;
            String str = guarantee.getStr();
            if (guarantee.getExpr() != null) {
                guarantees.add(new AgreeStatement(str, doSwitch(guarantee.getExpr()).accept(new SubstitutionVisitor(rewriteMap)), guarantee));
            } else {
                PatternStatement pattern = guarantee.getPattern();
                AgreeStatement patStatement = new AgreePatternBuilder(str, guarantee, this).doSwitch(pattern);
                patStatement.expr = patStatement.expr.accept(new SubstitutionVisitor(rewriteMap));
                guarantees.add(patStatement);
            }
        }
    }
    return guarantees;
}
Also used : GuaranteeStatement(com.rockwellcollins.atc.agree.agree.GuaranteeStatement) SubstitutionVisitor(jkind.translation.SubstitutionVisitor) PatternStatement(com.rockwellcollins.atc.agree.agree.PatternStatement) ArrayList(java.util.ArrayList) SpecStatement(com.rockwellcollins.atc.agree.agree.SpecStatement) AgreePatternBuilder(com.rockwellcollins.atc.agree.analysis.realtime.AgreePatternBuilder)

Example 2 with PatternStatement

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

the class AgreeASTBuilder method getAssertionStatements.

private List<AgreeStatement> getAssertionStatements(EList<SpecStatement> specs) {
    List<AgreeStatement> asserts = new ArrayList<>();
    for (SpecStatement spec : specs) {
        if (spec instanceof AssertStatement) {
            AssertStatement assertState = (AssertStatement) spec;
            String str = assertState.getStr();
            if (assertState.getExpr() != null) {
                asserts.add(new AgreeStatement(str, doSwitch(assertState.getExpr()), assertState));
            } else {
                PatternStatement pattern = assertState.getPattern();
                asserts.add(new AgreePatternBuilder(str, assertState, this).doSwitch(pattern));
            }
        }
    }
    return asserts;
}
Also used : PatternStatement(com.rockwellcollins.atc.agree.agree.PatternStatement) ArrayList(java.util.ArrayList) AssertStatement(com.rockwellcollins.atc.agree.agree.AssertStatement) SpecStatement(com.rockwellcollins.atc.agree.agree.SpecStatement) AgreePatternBuilder(com.rockwellcollins.atc.agree.analysis.realtime.AgreePatternBuilder)

Example 3 with PatternStatement

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

the class NamedSpecStatementImpl method basicSetPattern.

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

Example 4 with PatternStatement

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

the class AgreeASTBuilder method getReachableStatements.

private List<AgreeStatement> getReachableStatements(EList<SpecStatement> specs, Map<String, jkind.lustre.Expr> rewriteMap) {
    List<AgreeStatement> reachables = new ArrayList<>();
    for (SpecStatement spec : specs) {
        if (spec instanceof ReachableStatement) {
            ReachableStatement reachable = (ReachableStatement) spec;
            if (reachable.getExpr() != null) {
                reachables.add(new AgreeStatement(reachable.getStr(), new jkind.lustre.UnaryExpr(jkind.lustre.UnaryOp.NOT, doSwitch(reachable.getExpr()).accept(new SubstitutionVisitor(rewriteMap))), spec));
            } else {
                PatternStatement pattern = reachable.getPattern();
                AgreeStatement patStatement = new AgreePatternBuilder(reachable.getStr(), reachable, this).doSwitch(pattern);
                patStatement.expr = new jkind.lustre.UnaryExpr(jkind.lustre.UnaryOp.NOT, patStatement.expr.accept(new SubstitutionVisitor(rewriteMap)));
                reachables.add(patStatement);
            }
        }
    }
    return reachables;
}
Also used : SubstitutionVisitor(jkind.translation.SubstitutionVisitor) PatternStatement(com.rockwellcollins.atc.agree.agree.PatternStatement) ArrayList(java.util.ArrayList) UnaryExpr(jkind.lustre.UnaryExpr) SpecStatement(com.rockwellcollins.atc.agree.agree.SpecStatement) AgreePatternBuilder(com.rockwellcollins.atc.agree.analysis.realtime.AgreePatternBuilder) UnaryExpr(jkind.lustre.UnaryExpr) ReachableStatement(com.rockwellcollins.atc.agree.agree.ReachableStatement)

Example 5 with PatternStatement

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

the class AgreeASTBuilder method getAssumptionStatements.

private List<AgreeStatement> getAssumptionStatements(EList<SpecStatement> specs, Map<String, jkind.lustre.Expr> rewriteMap) {
    List<AgreeStatement> assumptions = new ArrayList<>();
    for (SpecStatement spec : specs) {
        if (spec instanceof AssumeStatement) {
            AssumeStatement assumption = (AssumeStatement) spec;
            String str = assumption.getStr();
            if (assumption.getExpr() != null) {
                assumptions.add(new AgreeStatement(str, doSwitch(assumption.getExpr()).accept(new SubstitutionVisitor(rewriteMap)), assumption));
            } else {
                PatternStatement pattern = assumption.getPattern();
                AgreeStatement patAssumption = new AgreePatternBuilder(str, assumption, this).doSwitch(pattern);
                patAssumption.expr = patAssumption.expr.accept(new SubstitutionVisitor(rewriteMap));
                assumptions.add(patAssumption);
            }
        }
    }
    return assumptions;
}
Also used : SubstitutionVisitor(jkind.translation.SubstitutionVisitor) PatternStatement(com.rockwellcollins.atc.agree.agree.PatternStatement) AssumeStatement(com.rockwellcollins.atc.agree.agree.AssumeStatement) ArrayList(java.util.ArrayList) SpecStatement(com.rockwellcollins.atc.agree.agree.SpecStatement) AgreePatternBuilder(com.rockwellcollins.atc.agree.analysis.realtime.AgreePatternBuilder)

Aggregations

PatternStatement (com.rockwellcollins.atc.agree.agree.PatternStatement)6 SpecStatement (com.rockwellcollins.atc.agree.agree.SpecStatement)5 AgreePatternBuilder (com.rockwellcollins.atc.agree.analysis.realtime.AgreePatternBuilder)5 ArrayList (java.util.ArrayList)5 SubstitutionVisitor (jkind.translation.SubstitutionVisitor)3 AssertStatement (com.rockwellcollins.atc.agree.agree.AssertStatement)1 AssumeStatement (com.rockwellcollins.atc.agree.agree.AssumeStatement)1 GuaranteeStatement (com.rockwellcollins.atc.agree.agree.GuaranteeStatement)1 LemmaStatement (com.rockwellcollins.atc.agree.agree.LemmaStatement)1 ReachableStatement (com.rockwellcollins.atc.agree.agree.ReachableStatement)1 UnaryExpr (jkind.lustre.UnaryExpr)1 ENotificationImpl (org.eclipse.emf.ecore.impl.ENotificationImpl)1