@Test public void convertToCnfTest() { Comparison a = getComparison(); Comparison b = getComparison(); XorPredicate xorPredicate = new XorPredicate(new Xor(a, b)); CNF reference = new OrPredicate( new Or( new And( a, new Not(b) ), new And( new Not(a), b ) ) ).asCNF(); assertEquals(reference, xorPredicate.asCNF()); }
public CNF asCNF() { Predicate lhs = xor.getArguments()[0]; Predicate rhs = xor.getArguments()[1]; QueryPredicate wrapper = QueryPredicate.createFrom( new Or(new And(lhs, new Not(rhs)), new And(new Not(lhs), rhs)) ); return wrapper.asCNF(); }
XorPredicate extends QueryPredicate { public CNF asCNF() { Predicate lhs = xor.getArguments()[0]; Predicate rhs = xor.getArguments()[1]; QueryPredicate wrapper = QueryPredicate.createFrom( new Or(new And(lhs, new Not(rhs)), new And(new Not(lhs), rhs)) ); return wrapper.asCNF(); } }
XorPredicate extends QueryPredicate { public CNF asCNF() { Predicate lhs = xor.getArguments()[0]; Predicate rhs = xor.getArguments()[1]; QueryPredicate wrapper = QueryPredicate.createFrom( new Or(new And(lhs, new Not(rhs)), new And(new Not(lhs), rhs)) ); return wrapper.asCNF(); } XorPredicate(Xor xor); }
XorPredicate extends QueryPredicate { public CNF asCNF() { Predicate lhs = xor.getArguments()[0]; Predicate rhs = xor.getArguments()[1]; QueryPredicate wrapper = QueryPredicate.createFrom( new Or(new And(lhs, new Not(rhs)), new And(new Not(lhs), rhs)) ); return wrapper.asCNF(); } XorPredicate(Xor xor); CNF asCNF(); QueryPredicate getLhs(); QueryPredicate getRhs(); @Override boolean equals(Object o); @Override int hashCode(); }
XorPredicate extends QueryPredicate { public CNF asCNF() { Predicate lhs = xor.getArguments()[0]; Predicate rhs = xor.getArguments()[1]; QueryPredicate wrapper = QueryPredicate.createFrom( new Or(new And(lhs, new Not(rhs)), new And(new Not(lhs), rhs)) ); return wrapper.asCNF(); } XorPredicate(Xor xor); CNF asCNF(); QueryPredicate getLhs(); QueryPredicate getRhs(); @Override boolean equals(Object o); @Override int hashCode();  }