#1426 - ENH: Add bitwiseNot expression ... e.g. bitwiseNot("flags", BwFlags.HAS_COLOUR)

This commit is contained in:
rob bygrave
2018-06-14 23:28:30 +12:00
parent 81c6d4601d
commit 59537227b6
4 changed files with 38 additions and 0 deletions
@@ -1031,6 +1031,20 @@ public interface ExpressionList<T> {
*/
ExpressionList<T> bitwiseAll(String propertyName, long flags);
/**
* Add expression for the given bit flags to be NOT set.
* <p>
* <pre>{@code
*
* where().bitwiseNot("flags", BwFlags.HAS_COLOUR)
*
* }</pre>
*
* @param propertyName The property that holds the flags value
* @param flags The flags we are looking for
*/
ExpressionList<T> bitwiseNot(String propertyName, long flags);
/**
* Add bitwise AND expression of the given bit flags to compare with the match/mask.
* <p>
@@ -711,6 +711,12 @@ public class DefaultExpressionList<T> implements SpiExpressionList<T> {
return this;
}
@Override
public ExpressionList<T> bitwiseNot(String propertyName, long flags) {
add(expr.bitwiseAnd(propertyName, flags, 0));
return this;
}
@Override
public ExpressionList<T> bitwiseAll(String propertyName, long flags) {
add(expr.bitwiseAll(propertyName, flags));
@@ -554,6 +554,11 @@ class JunctionExpression<T> implements SpiJunction<T>, SpiExpression, Expression
return exprList.bitwiseAnd(propertyName, flags, match);
}
@Override
public ExpressionList<T> bitwiseNot(String propertyName, long flags) {
return exprList.bitwiseNot(propertyName, flags);
}
@Override
public ExpressionList<T> ge(String propertyName, Object value) {
return exprList.ge(propertyName, value);