public bool?visitBinarySentence(ComplexSentence bs, bool?arg) { bool?firstValue = bs.getSimplerSentence(0).accept(this, null); bool?secondValue = bs.getSimplerSentence(1).accept(this, null); if ((firstValue == null) || (secondValue == null)) { // strictly not true for or/and // -FIX later return(null); } else { Connective connective = bs.getConnective(); if (connective.Equals(Connective.AND)) { return(firstValue.Value && secondValue.Value); } else if (connective.Equals(Connective.OR)) { return(firstValue.Value || secondValue.Value); } else if (connective.Equals(Connective.IMPLICATION)) { return(!(firstValue.Value && !secondValue.Value)); } else if (connective.Equals(Connective.BICONDITIONAL)) { return(firstValue.Equals(secondValue)); } return(null); } }
public virtual Sentence visitBinarySentence(ComplexSentence s, A arg) { // a new Complex Sentence with the same connective but possibly // with its simpler sentences replaced by the visitor. return(new ComplexSentence(s.getConnective(), s.getSimplerSentence(0) .accept(this, arg), s.getSimplerSentence(1).accept(this, arg))); }