Search in sources :

Example 1 with ANegationPredicate

use of de.be4.classicalb.core.parser.node.ANegationPredicate in project probparsers by bendisposto.

the class SyntaxExtensionTranslator method outAIfPredicatePredicate.

@Override
public void outAIfPredicatePredicate(AIfPredicatePredicate node) {
    // IF P THE P2 ELSE P3 END
    // will be translated into
    // (p => p2) & (not(p) => p3)
    AImplicationPredicate imp1 = new AImplicationPredicate((PPredicate) cloneNode(node.getCondition()), (PPredicate) cloneNode(node.getThen()));
    AImplicationPredicate imp2 = new AImplicationPredicate(new ANegationPredicate((PPredicate) cloneNode(node.getCondition())), (PPredicate) cloneNode(node.getElse()));
    AConjunctPredicate con = new AConjunctPredicate(imp1, imp2);
    con.setStartPos(node.getStartPos());
    con.setEndPos(node.getEndPos());
    node.replaceBy(con);
}
Also used : AConjunctPredicate(de.be4.classicalb.core.parser.node.AConjunctPredicate) AImplicationPredicate(de.be4.classicalb.core.parser.node.AImplicationPredicate) ANegationPredicate(de.be4.classicalb.core.parser.node.ANegationPredicate) PPredicate(de.be4.classicalb.core.parser.node.PPredicate)

Aggregations

AConjunctPredicate (de.be4.classicalb.core.parser.node.AConjunctPredicate)1 AImplicationPredicate (de.be4.classicalb.core.parser.node.AImplicationPredicate)1 ANegationPredicate (de.be4.classicalb.core.parser.node.ANegationPredicate)1 PPredicate (de.be4.classicalb.core.parser.node.PPredicate)1