/** * Chains this expression with other expressions using "and". * * @since 4.0 */ public Expression andExp(Expression exp, Expression... expressions) { return joinExp(Expression.AND, exp, expressions); }
/** * Chains this expression with another expression using "and". */ public Expression andExp(Expression exp) { return joinExp(Expression.AND, exp); }
/** * Chains this expression with another expression using "or". */ public Expression orExp(Expression exp) { return joinExp(Expression.OR, exp); }
/** * Chains this expression with other expressions using "or". * * @since 4.0 */ public Expression orExp(Expression exp, Expression... expressions) { return joinExp(Expression.OR, exp, expressions); }
/** * Creates a new expression that joins this object with another expression, * using specified join type. It is very useful for incrementally building * chained expressions, like long AND or OR statements. */ public Expression joinExp(int type, Expression exp) { return joinExp(type, exp, new Expression[0]); }
/** * Chains this expression with another expression using "or". */ public Expression orExp(Expression exp) { return joinExp(Expression.OR, exp); }
/** * Chains this expression with another expression using "and". */ public Expression andExp(Expression exp) { return joinExp(Expression.AND, exp); }
/** * In case requested expression type is the same as internal type, creates and returns * a copy of this expression with the internal list of operands expanded with the new * expression. If the type of expression is different from this, calls superclass's * implementation. */ public Expression joinExp(int type, Expression exp) { if (type != this.type) { return super.joinExp(type, exp); } // create a copy of self ListExpression copy = new ListExpression(); copy.setType(type); copy.appendOperands(operands); copy.appendOperand(exp); return copy; }