public static final Operation AND = new Operation("AND");
public static final Operation OR = new Operation("OR");
public static final Operation NOT = new Operation("NOT");
+
+ public String name() {
+ String name=left.name();
+ name+=op.toString();
+ if (right!=null)
+ name+=right.name();
+ return name;
+ }
+
+ public Set getInversedRelations() {
+ if (left == null) {
+ throw new IRException();
+ }
+ Set set = left.getInversedRelations();
+ if (right != null) {
+ set.addAll(right.getInversedRelations());
+ }
+ return set;
+ }
+ public DNFConstraint constructDNF() {
+ if (op==AND) {
+ DNFConstraint leftd=left.constructDNF();
+ DNFConstraint rightd=right.constructDNF();
+ return leftd.and(rightd);
+ } else if (op==OR) {
+ DNFConstraint leftd=left.constructDNF();
+ DNFConstraint rightd=right.constructDNF();
+ return leftd.or(rightd);
+ } else if (op==NOT) {
+ DNFConstraint leftd=left.constructDNF();
+ return leftd.not();
+ } else throw new Error();
+ }
+
public static class Operation {
private final String name;
private Operation(String opname) { name = opname; }