use of de.bmoth.parser.ast.nodes.ltl.LTLPrefixOperatorNode in project bmoth by hhu-stups.
the class LTLFormulaTest method testGloballyFinally.
@Test
public void testGloballyFinally() throws ParserException {
String formula = "FG { 1=1 }";
LTLFormula ltlFormula = Parser.getLTLFormulaAsSemanticAst(formula);
Node f1 = ltlFormula.getLTLNode();
assertTrue(f1 instanceof LTLPrefixOperatorNode);
LTLPrefixOperatorNode p1 = (LTLPrefixOperatorNode) f1;
assertEquals(LTLPrefixOperatorNode.Kind.FINALLY, p1.getKind());
LTLNode f2 = p1.getArgument();
assertTrue(f2 instanceof LTLPrefixOperatorNode);
LTLPrefixOperatorNode p2 = (LTLPrefixOperatorNode) f2;
assertEquals(LTLPrefixOperatorNode.Kind.GLOBALLY, p2.getKind());
LTLNode f3 = p2.getArgument();
assertTrue(f3 instanceof LTLBPredicateNode);
LTLBPredicateNode p3 = (LTLBPredicateNode) f3;
assertTrue(p3.getPredicate() != null);
}
use of de.bmoth.parser.ast.nodes.ltl.LTLPrefixOperatorNode in project bmoth by hhu-stups.
the class ConvertNotOrToAndNot method transformNode.
@Override
public Node transformNode(Node node) {
LTLPrefixOperatorNode outerNot = (LTLPrefixOperatorNode) node;
LTLInfixOperatorNode innerOr = (LTLInfixOperatorNode) outerNot.getArgument();
return new LTLInfixOperatorNode(AND, new LTLPrefixOperatorNode(NOT, innerOr.getLeft()), new LTLPrefixOperatorNode(NOT, innerOr.getRight()));
}
use of de.bmoth.parser.ast.nodes.ltl.LTLPrefixOperatorNode in project bmoth by hhu-stups.
the class ConvertNotUntil method transformNode.
@Override
public Node transformNode(Node oldNode) {
LTLPrefixOperatorNode notOperator = (LTLPrefixOperatorNode) oldNode;
LTLNode argument = notOperator.getArgument();
LTLInfixOperatorNode untilOperator = (LTLInfixOperatorNode) argument;
LTLNode left = untilOperator.getLeft();
LTLNode right = untilOperator.getRight();
LTLPrefixOperatorNode notRight = new LTLPrefixOperatorNode(NOT, right);
LTLPrefixOperatorNode notLeft = new LTLPrefixOperatorNode(NOT, left);
return new LTLInfixOperatorNode(LTLInfixOperatorNode.Kind.RELEASE, notLeft, notRight);
}
use of de.bmoth.parser.ast.nodes.ltl.LTLPrefixOperatorNode in project bmoth by hhu-stups.
the class ConvertFinallyPhiOrPsiToFinallyPhiOrFinallyPsi method transformNode.
@Override
public Node transformNode(Node oldNode) {
LTLPrefixOperatorNode finallyOperator = (LTLPrefixOperatorNode) oldNode;
LTLNode argument = finallyOperator.getArgument();
LTLInfixOperatorNode orOperator = (LTLInfixOperatorNode) argument;
LTLPrefixOperatorNode newNextLeft = new LTLPrefixOperatorNode(FINALLY, orOperator.getLeft());
LTLPrefixOperatorNode newNextRight = new LTLPrefixOperatorNode(FINALLY, orOperator.getRight());
return new LTLInfixOperatorNode(OR, newNextLeft, newNextRight);
}
use of de.bmoth.parser.ast.nodes.ltl.LTLPrefixOperatorNode in project bmoth by hhu-stups.
the class ConvertNotGloballyToFinallyNot method transformNode.
@Override
public Node transformNode(Node node) {
LTLPrefixOperatorNode not = (LTLPrefixOperatorNode) node;
LTLPrefixOperatorNode globally = (LTLPrefixOperatorNode) not.getArgument();
LTLNode inner = globally.getArgument();
return new LTLPrefixOperatorNode(FINALLY, new LTLPrefixOperatorNode(NOT, inner));
}
Aggregations