Search in sources :

Example 41 with Expression

use of verdict.vdm.vdm_lustre.Expression in project VERDICT by ge-high-assurance.

the class PrettyPrinter method visit.

public void visit(NodeProperty property) {
    sb.append("--%PROPERTY ");
    String property_name = property.getName();
    sb.append(property_name);
    sb.append(TAB);
    Expression expr = property.getExpression();
    visit(expr);
    sb.append(";");
    sb.append(NL);
// visit(expr);
}
Also used : Expression(verdict.vdm.vdm_lustre.Expression)

Example 42 with Expression

use of verdict.vdm.vdm_lustre.Expression in project VERDICT by ge-high-assurance.

the class PrettyPrinter method visit.

public void visit(SymbolDefinition symbolDef) {
    String symbol_name = symbolDef.getName();
    sb.append(symbol_name);
    sb.append(TAB);
    DataType dataType = symbolDef.getDataType();
    sb.append(":");
    visit(dataType);
    sb.append(" = ");
    Expression expr = symbolDef.getDefinition();
// visit(expr);
}
Also used : Expression(verdict.vdm.vdm_lustre.Expression) DataType(verdict.vdm.vdm_data.DataType)

Example 43 with Expression

use of verdict.vdm.vdm_lustre.Expression in project VERDICT by ge-high-assurance.

the class PrettyPrinter method visit.

public void visit(NodeBody nodeBody) {
    sb.append("let");
    sb.append(NL);
    if (nodeBody.getVariableDeclaration().size() > 0) {
        sb.append("var");
        sb.append(NL);
    }
    for (VariableDeclaration var : nodeBody.getVariableDeclaration()) {
        visit(var);
        sb.append(NL);
        sb.append(";");
    }
    for (ConstantDeclaration constant : nodeBody.getConstantDeclaration()) {
        sb.append("const");
        visit(constant);
        sb.append(NL);
        sb.append(";");
    }
    for (Expression expr : nodeBody.getAssertion()) {
        visit(expr);
    }
    for (NodeEquation neq : nodeBody.getEquation()) {
        visit(neq);
    }
    for (NodeProperty property : nodeBody.getProperty()) {
        visit(property);
    }
    sb.append("tel");
}
Also used : NodeEquation(verdict.vdm.vdm_lustre.NodeEquation) Expression(verdict.vdm.vdm_lustre.Expression) NodeProperty(verdict.vdm.vdm_lustre.NodeProperty) ConstantDeclaration(verdict.vdm.vdm_lustre.ConstantDeclaration) VariableDeclaration(verdict.vdm.vdm_lustre.VariableDeclaration)

Example 44 with Expression

use of verdict.vdm.vdm_lustre.Expression in project VERDICT by ge-high-assurance.

the class Agree2Vdm method translateAssumeStatement.

private ContractItem translateAssumeStatement(AssumeStatement assumeStmt, HashSet<String> dataTypeDecl, HashSet<String> nodeDecl, Model model) {
    ContractItem contractItem = new ContractItem();
    contractItem.setName(assumeStmt.getStr());
    Expr agreeExpr = assumeStmt.getExpr();
    Expression vdmlustrExpr = getVdmExpressionFromAgreeExpression(agreeExpr, dataTypeDecl, nodeDecl, model);
    contractItem.setExpression(vdmlustrExpr);
    return contractItem;
}
Also used : EnumLitExpr(com.rockwellcollins.atc.agree.agree.EnumLitExpr) RealLitExpr(com.rockwellcollins.atc.agree.agree.RealLitExpr) EventExpr(com.rockwellcollins.atc.agree.agree.EventExpr) NamedElmExpr(com.rockwellcollins.atc.agree.agree.NamedElmExpr) SelectionExpr(com.rockwellcollins.atc.agree.agree.SelectionExpr) IfThenElseExpr(com.rockwellcollins.atc.agree.agree.IfThenElseExpr) PreExpr(com.rockwellcollins.atc.agree.agree.PreExpr) RecordLitExpr(com.rockwellcollins.atc.agree.agree.RecordLitExpr) BinaryExpr(com.rockwellcollins.atc.agree.agree.BinaryExpr) UnaryExpr(com.rockwellcollins.atc.agree.agree.UnaryExpr) Expr(com.rockwellcollins.atc.agree.agree.Expr) 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) ContractItem(verdict.vdm.vdm_lustre.ContractItem) PropertyExpression(org.osate.aadl2.PropertyExpression) Expression(verdict.vdm.vdm_lustre.Expression)

Example 45 with Expression

use of verdict.vdm.vdm_lustre.Expression in project VERDICT by ge-high-assurance.

the class VerdictTestInstrumentor method instrumentTests.

/**
 * Produce one affirmative and one negated guarantee for every cyber requirement in the
 * top-level system of the model.
 */
public void instrumentTests() {
    ComponentType topLevel = getTopLevelSystemType();
    List<ContractItem> guarantees = topLevel.getContract().getGuarantee();
    List<ContractItem> replaceWith = new ArrayList<>();
    for (ContractItem guarantee : guarantees) {
        String name = guarantee.getName();
        // Build negated expression
        Expression negExpr = new Expression();
        negExpr.setNot(guarantee.getExpression());
        ContractItem pos = new ContractItem();
        pos.setExpression(guarantee.getExpression());
        pos.setName("pos_" + name);
        ContractItem neg = new ContractItem();
        neg.setExpression(negExpr);
        neg.setName("neg_" + name);
        replaceWith.add(pos);
        replaceWith.add(neg);
    }
    // Remove old guarantees and use our own
    guarantees.clear();
    guarantees.addAll(replaceWith);
}
Also used : ComponentType(verdict.vdm.vdm_model.ComponentType) ContractItem(verdict.vdm.vdm_lustre.ContractItem) Expression(verdict.vdm.vdm_lustre.Expression) ArrayList(java.util.ArrayList)

Aggregations

Expression (verdict.vdm.vdm_lustre.Expression)45 ContractItem (verdict.vdm.vdm_lustre.ContractItem)9 BinaryOperation (verdict.vdm.vdm_lustre.BinaryOperation)8 NodeCall (verdict.vdm.vdm_lustre.NodeCall)7 DataType (verdict.vdm.vdm_data.DataType)6 ComponentType (verdict.vdm.vdm_model.ComponentType)6 PropertyExpression (org.osate.aadl2.PropertyExpression)5 ConstantDeclaration (verdict.vdm.vdm_lustre.ConstantDeclaration)5 IfThenElse (verdict.vdm.vdm_lustre.IfThenElse)5 NodeEquation (verdict.vdm.vdm_lustre.NodeEquation)5 RecordLiteral (verdict.vdm.vdm_lustre.RecordLiteral)5 SymbolDefinition (verdict.vdm.vdm_lustre.SymbolDefinition)5 CompInstancePort (verdict.vdm.vdm_model.CompInstancePort)5 ComponentImpl (verdict.vdm.vdm_model.ComponentImpl)5 Port (verdict.vdm.vdm_model.Port)5 BinaryExpr (com.rockwellcollins.atc.agree.agree.BinaryExpr)4 BoolLitExpr (com.rockwellcollins.atc.agree.agree.BoolLitExpr)4 CallExpr (com.rockwellcollins.atc.agree.agree.CallExpr)4 EnumLitExpr (com.rockwellcollins.atc.agree.agree.EnumLitExpr)4 EventExpr (com.rockwellcollins.atc.agree.agree.EventExpr)4