private boolean parentIsNotOfClass ( BaseCondition condition , Class < ? extends BooleanCondition > expectedParentClass ) { BaseCondition parent = condition . getParent ( ) ; return parent != null && parent . getClass ( ) != expectedParentClass ; }
We check if the parent if of the expected class hoping that if it is then we can avoid wrapping this condition in parentheses and still maintain the same logic .