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;
}
}