private static Condition flattenIn(Condition condition) { switch (condition.type()) { case RELATION: Relation relation = (Relation) condition; switch (relation.relation()) { case IN: // Flatten IN if needed return convIn2Or(relation); case NOT_IN: // Flatten NOT_IN if needed return convNotin2And(relation); case TEXT_CONTAINS_ANY: // Flatten TEXT_CONTAINS_ANY if needed return convTextContainsAny2Or(relation); default: return condition; } case AND: Condition.And and = (Condition.And) condition; return new Condition.And(flattenIn(and.left()), flattenIn(and.right())); case OR: Condition.Or or = (Condition.Or) condition; return new Condition.Or(flattenIn(or.left()), flattenIn(or.right())); default: throw new AssertionError(String.format( "Wrong condition type: '%s'", condition.type())); } }
private static Condition flattenIn(Condition condition) { switch (condition.type()) { case RELATION: Relation relation = (Relation) condition; switch (relation.relation()) { case IN: // Flatten IN if needed return convIn2Or(relation); case NOT_IN: // Flatten NOT_IN if needed return convNotin2And(relation); case TEXT_CONTAINS_ANY: // Flatten TEXT_CONTAINS_ANY if needed return convTextContainsAny2Or(relation); default: return condition; } case AND: Condition.And and = (Condition.And) condition; return new Condition.And(flattenIn(and.left()), flattenIn(and.right())); case OR: Condition.Or or = (Condition.Or) condition; return new Condition.Or(flattenIn(or.left()), flattenIn(or.right())); default: throw new AssertionError(String.format( "Wrong condition type: '%s'", condition.type())); } }
public Condition or(Condition other) { return new Or(this, other); }
public static Condition or(Condition left, Condition right) { return new Or(left, right); }
@Override public Condition copy() { return new Or(this.left().copy(), this.right().copy()); } }
public Condition or(Condition other) { return new Or(this, other); }
public static Condition or(Condition left, Condition right) { return new Or(left, right); }
@Override public Condition copy() { return new Or(this.left().copy(), this.right().copy()); } }