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);
}
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);
}
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");
}
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;
}
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);
}
Aggregations