private static Selector simplifyTree ( Selector tree ) { if ( ! ( tree instanceof Operator ) || tree instanceof ExtensionOperatorImpl ) return tree ; Operator oper = ( Operator ) tree ; switch ( oper . getOp ( ) ) { case Selector . NOT : return simplifyNOT ( oper . getOperands ( ) [ 0 ] ) ; case Selector . EQ : return simplifyEQ ( oper . getOperands ( ) [ 0 ] , oper . getOperands ( ) [ 1 ] ) ; case Selector . NE : return simplifyNE ( oper . getOperands ( ) [ 0 ] , oper . getOperands ( ) [ 1 ] ) ; case Selector . NEG : case Selector . ISNULL : return new OperatorImpl ( oper . getOp ( ) , simplifyTree ( oper . getOperands ( ) [ 0 ] ) ) ; case Selector . LIKE : case Selector . TOPIC_LIKE : LikeOperatorImpl loper = ( LikeOperatorImpl ) oper ; return new LikeOperatorImpl ( loper . getOp ( ) , simplifyTree ( loper . getOperands ( ) [ 0 ] ) , loper . getInternalPattern ( ) , loper . getPattern ( ) , loper . isEscaped ( ) , loper . getEscape ( ) ) ; default : return new OperatorImpl ( oper . getOp ( ) , simplifyTree ( oper . getOperands ( ) [ 0 ] ) , simplifyTree ( oper . getOperands ( ) [ 1 ] ) ) ; } }
and OR nodes