firstTermIsAndSentence() public method

public firstTermIsAndSentence ( ) : bool
return bool
Ejemplo n.º 1
0
 public override Object visitBinarySentence(BinarySentence bs, Object arg)
 {
     if (bs.isBiconditional())
     {
         return transformBiConditionalSentence(bs);
     }
     else if (bs.isImplication())
     {
         return transformImpliedSentence(bs);
     }
     else if (bs.isOrSentence()
           && (bs.firstTermIsAndSentence() || bs.secondTermIsAndSentence()))
     {
         return distributeOrOverAnd(bs);
     }
     else
     {
         return base.visitBinarySentence(bs, arg);
     }
 }
Ejemplo n.º 2
0
 private Sentence distributeOrOverAnd(BinarySentence bs)
 {
     BinarySentence andTerm = bs.firstTermIsAndSentence() ? (BinarySentence)bs
             .getFirst()
             : (BinarySentence)bs.getSecond();
     Sentence otherterm = bs.firstTermIsAndSentence() ? bs.getSecond() : bs
             .getFirst();
     // (alpha or (beta and gamma) = ((alpha or beta) and (alpha or gamma))
     Sentence alpha = (Sentence)otherterm.accept(this, null);
     Sentence beta = (Sentence)andTerm.getFirst().accept(this, null);
     Sentence gamma = (Sentence)andTerm.getSecond().accept(this, null);
     Sentence distributed = new BinarySentence("AND", new BinarySentence(
             "OR", alpha, beta), new BinarySentence("OR", alpha, gamma));
     return distributed;
 }