public AndImpl pullOrRight() { if (getLastConstraint() instanceof OrImpl) { return this; } ArrayList<ConstraintImpl> andList = getAllAndConditions(); for (int i = 0; i < andList.size() - 1; i++) { ConstraintImpl c = andList.get(i); if (c instanceof OrImpl) { ArrayList<ConstraintImpl> list = new ArrayList<ConstraintImpl>(); list.addAll(andList); list.remove(i); list.add(c); return new AndImpl(list); } } return this; }
public AndImpl pullOrRight() { if (getLastConstraint() instanceof OrImpl) { return this; } ArrayList<ConstraintImpl> andList = getAllAndConditions(); for (int i = 0; i < andList.size() - 1; i++) { ConstraintImpl c = andList.get(i); if (c instanceof OrImpl) { ArrayList<ConstraintImpl> list = new ArrayList<ConstraintImpl>(); list.addAll(andList); list.remove(i); list.add(c); return new AndImpl(list); } } return this; }
public AndImpl pullOrRight() { if (getLastConstraint() instanceof OrImpl) { return this; } ArrayList<ConstraintImpl> andList = getAllAndConditions(); for (int i = 0; i < andList.size() - 1; i++) { ConstraintImpl c = andList.get(i); if (c instanceof OrImpl) { ArrayList<ConstraintImpl> list = new ArrayList<ConstraintImpl>(); list.addAll(andList); list.remove(i); list.add(c); return new AndImpl(list); } } return this; }
public void addToUnionList(Set<ConstraintImpl> target) { // conditions of type // @a = 1 and (@x = 1 or @y = 2) // are automatically converted to // (@a = 1 and @x = 1) union (@a = 1 and @y = 2) AndImpl and = pullOrRight(); ConstraintImpl last = and.getLastConstraint(); if (last instanceof OrImpl) { OrImpl or = (OrImpl) last; // same as above, but with the added "and" for(ConstraintImpl c : or.getConstraints()) { ArrayList<ConstraintImpl> list = and.getFirstConstraints(); list.add(c); new AndImpl(list).addToUnionList(target); } return; } target.add(this); }
public void addToUnionList(Set<ConstraintImpl> target) { // conditions of type // @a = 1 and (@x = 1 or @y = 2) // are automatically converted to // (@a = 1 and @x = 1) union (@a = 1 and @y = 2) AndImpl and = pullOrRight(); ConstraintImpl last = and.getLastConstraint(); if (last instanceof OrImpl) { OrImpl or = (OrImpl) last; // same as above, but with the added "and" for(ConstraintImpl c : or.getConstraints()) { ArrayList<ConstraintImpl> list = and.getFirstConstraints(); list.add(c); new AndImpl(list).addToUnionList(target); } return; } target.add(this); }
public void addToUnionList(Set<ConstraintImpl> target) { // conditions of type // @a = 1 and (@x = 1 or @y = 2) // are automatically converted to // (@a = 1 and @x = 1) union (@a = 1 and @y = 2) AndImpl and = pullOrRight(); ConstraintImpl last = and.getLastConstraint(); if (last instanceof OrImpl) { OrImpl or = (OrImpl) last; // same as above, but with the added "and" for(ConstraintImpl c : or.getConstraints()) { ArrayList<ConstraintImpl> list = and.getFirstConstraints(); list.add(c); new AndImpl(list).addToUnionList(target); } return; } target.add(this); }