public static boolean reduce ( AbstractExpression expr , Predicate < AbstractExpression > pred ) { final boolean current = pred . test ( expr ) ; if ( current ) { return true ; } else if ( expr == null ) { return pred . test ( null ) ; } else { return pred . test ( expr . getLeft ( ) ) || pred . test ( expr . getRight ( ) ) || expr . getArgs ( ) != null && expr . getArgs ( ) . stream ( ) . anyMatch ( pred ) ; } }
Check if any node of given expression tree satisfies given predicate