public static Collection < AbstractExpression > uncombineAny ( AbstractExpression expr ) { ArrayDeque < AbstractExpression > out = new ArrayDeque < AbstractExpression > ( ) ; if ( expr != null ) { ArrayDeque < AbstractExpression > in = new ArrayDeque < AbstractExpression > ( ) ; // this chunk of code breaks the code into a list of expression that // all have to be true for the where clause to be true in . add ( expr ) ; AbstractExpression inExpr = null ; while ( ( inExpr = in . poll ( ) ) != null ) { if ( inExpr . getExpressionType ( ) == ExpressionType . CONJUNCTION_AND ) { in . add ( inExpr . getLeft ( ) ) ; in . add ( inExpr . getRight ( ) ) ; } else { out . add ( inExpr ) ; } } } return out ; }
Convert one or more predicates potentially in an arbitrarily nested conjunction tree into a flattened collection . Similar to uncombine but for arbitrary tree shapes and with no guarantee of the result collection type or of any ordering within the collection . In fact it currently fills an ArrayDeque via a left = to - right breadth first traversal but for no particular reason so that s all subject to change .