use of de.bmoth.parser.ast.nodes.ltl.LTLBPredicateNode 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.LTLBPredicateNode in project bmoth by hhu-stups.
the class FormulaVisitorExceptionsTest method init.
@Before
public void init() {
visitor = new FormulaVisitor<Object, Object>() {
@Override
public Object visitEnumerationSetNode(EnumerationSetNode node, Object expected) {
return null;
}
@Override
public Object visitDeferredSetNode(DeferredSetNode node, Object expected) {
return null;
}
@Override
public Object visitEnumeratedSetElementNode(EnumeratedSetElementNode node, Object expected) {
return null;
}
@Override
public Object visitExprOperatorNode(ExpressionOperatorNode node, Object expected) {
return null;
}
@Override
public Object visitIdentifierExprNode(IdentifierExprNode node, Object expected) {
return null;
}
@Override
public Object visitCastPredicateExpressionNode(CastPredicateExpressionNode node, Object expected) {
return null;
}
@Override
public Object visitNumberNode(NumberNode node, Object expected) {
return null;
}
@Override
public Object visitQuantifiedExpressionNode(QuantifiedExpressionNode node, Object expected) {
return null;
}
@Override
public Object visitSetComprehensionNode(SetComprehensionNode node, Object expected) {
return null;
}
@Override
public Object visitIdentifierPredicateNode(IdentifierPredicateNode node, Object expected) {
return null;
}
@Override
public Object visitPredicateOperatorNode(PredicateOperatorNode node, Object expected) {
return null;
}
@Override
public Object visitPredicateOperatorWithExprArgs(PredicateOperatorWithExprArgsNode node, Object expected) {
return null;
}
@Override
public Object visitQuantifiedPredicateNode(QuantifiedPredicateNode node, Object expected) {
return null;
}
@Override
public Object visitLTLPrefixOperatorNode(LTLPrefixOperatorNode node, Object expected) {
return null;
}
@Override
public Object visitLTLKeywordNode(LTLKeywordNode node, Object expected) {
return null;
}
@Override
public Object visitLTLInfixOperatorNode(LTLInfixOperatorNode node, Object expected) {
return null;
}
@Override
public Object visitLTLBPredicateNode(LTLBPredicateNode node, Object expected) {
return null;
}
};
terminalNode = new TerminalNode() {
@Override
public Token getSymbol() {
return null;
}
@Override
public ParseTree getParent() {
return null;
}
@Override
public ParseTree getChild(int i) {
return null;
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> parseTreeVisitor) {
return null;
}
@Override
public String getText() {
return null;
}
@Override
public String toStringTree(Parser parser) {
return null;
}
@Override
public Interval getSourceInterval() {
return null;
}
@Override
public Object getPayload() {
return null;
}
@Override
public int getChildCount() {
return 0;
}
@Override
public String toStringTree() {
return null;
}
@Override
public void setParent(RuleContext parent) {
// not needed in test stub
}
};
}
use of de.bmoth.parser.ast.nodes.ltl.LTLBPredicateNode in project bmoth by hhu-stups.
the class SubstitutionVisitorExceptionsTest method init.
@Before
public void init() {
visitor = new SubstitutionVisitor<Object, Object>() {
@Override
public Object visitSkipSubstitutionNode(SkipSubstitutionNode node, Object expected) {
return null;
}
@Override
public Object visitIfSubstitutionNode(IfSubstitutionNode node, Object expected) {
return null;
}
@Override
public Object visitConditionSubstitutionNode(ConditionSubstitutionNode node, Object expected) {
return null;
}
@Override
public Object visitAnySubstitution(AnySubstitutionNode node, Object expected) {
return null;
}
@Override
public Object visitSelectSubstitutionNode(SelectSubstitutionNode node, Object expected) {
return null;
}
@Override
public Object visitSingleAssignSubstitution(SingleAssignSubstitutionNode node, Object expected) {
return null;
}
@Override
public Object visitParallelSubstitutionNode(ParallelSubstitutionNode node, Object expected) {
return null;
}
@Override
public Object visitBecomesElementOfSubstitutionNode(BecomesElementOfSubstitutionNode node, Object expected) {
return null;
}
@Override
public Object visitBecomesSuchThatSubstitutionNode(BecomesSuchThatSubstitutionNode node, Object expected) {
return null;
}
@Override
public Object visitLTLPrefixOperatorNode(LTLPrefixOperatorNode node, Object expected) {
return null;
}
@Override
public Object visitLTLKeywordNode(LTLKeywordNode node, Object expected) {
return null;
}
@Override
public Object visitLTLInfixOperatorNode(LTLInfixOperatorNode node, Object expected) {
return null;
}
@Override
public Object visitLTLBPredicateNode(LTLBPredicateNode node, Object expected) {
return null;
}
};
terminalNode = new TerminalNode() {
@Override
public Token getSymbol() {
return new Token() {
@Override
public String getText() {
return "adsf";
}
@Override
public int getType() {
return 0;
}
@Override
public int getLine() {
return 0;
}
@Override
public int getCharPositionInLine() {
return 0;
}
@Override
public int getChannel() {
return 0;
}
@Override
public int getTokenIndex() {
return 0;
}
@Override
public int getStartIndex() {
return 0;
}
@Override
public int getStopIndex() {
return 0;
}
@Override
public TokenSource getTokenSource() {
return null;
}
@Override
public CharStream getInputStream() {
return null;
}
};
}
@Override
public ParseTree getParent() {
return null;
}
@Override
public ParseTree getChild(int i) {
return null;
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> parseTreeVisitor) {
return null;
}
@Override
public String getText() {
return null;
}
@Override
public String toStringTree(Parser parser) {
return null;
}
@Override
public Interval getSourceInterval() {
return null;
}
@Override
public Object getPayload() {
return null;
}
@Override
public int getChildCount() {
return 0;
}
@Override
public String toStringTree() {
return null;
}
@Override
public void setParent(RuleContext parent) {
// not needed in test stub
}
};
}
use of de.bmoth.parser.ast.nodes.ltl.LTLBPredicateNode in project bmoth by hhu-stups.
the class ConvertNotFormulaToNegatedBFormula method transformNode.
@Override
public Node transformNode(Node node) {
LTLPrefixOperatorNode notOperator = (LTLPrefixOperatorNode) node;
LTLNode argument = notOperator.getArgument();
LTLBPredicateNode bPredicateNode = (LTLBPredicateNode) argument;
PredicateNode negatedPredicate = bPredicateNode.getPredicate().getNegatedPredicateNode();
return new LTLBPredicateNode(negatedPredicate);
}
Aggregations