void checkForCycles(QueryExpression expr) throws IllegalArgumentException {
        // is the expression argument equal to this?
        if (expr == this) throw new IllegalArgumentException("Cyclic expression detected");

        // recurse through nested expression if it's a composite expression
        QueryExpression nested = this.expr;
        if (nested instanceof CompositeQueryExpression) {
            ((CompositeQueryExpression)nested).checkForCycles(expr);
        }
        else if (nested instanceof Not) {
            ((Not)nested).checkForCycles(expr);
        }
    }
void checkForCycles(QueryExpression expr) throws IllegalArgumentException {
        
        if (expr == this) throw new IllegalArgumentException("Cyclic expression detected");

        
        QueryExpression nested = this.expr;
        if (nested instanceof CompositeQueryExpression) {
            ((CompositeQueryExpression)nested).checkForCycles(expr);
        }
        else if (nested instanceof Not) {
            ((Not)nested).checkForCycles(expr);
        }
    }
void checkForCycles ( QueryExpression expr ) throws IllegalArgumentException { // is the expression argument equal to this? if ( expr == this ) throw new IllegalArgumentException ( "Cyclic expression detected" ) ; // recurse through nested expression if it's a composite expression QueryExpression nested = this . expr ; if ( nested instanceof CompositeQueryExpression ) { ( ( CompositeQueryExpression ) nested ) . checkForCycles ( expr ) ; } else if ( nested instanceof Not ) { ( ( Not ) nested ) . checkForCycles ( expr ) ; } }
Check whether the specified expression contains a reference, either direct
or indirect, to this expression.
@param expr the expression to check and possibly recurse through.
@throws IllegalArgumentException if a cyclic expression is detected.
Check whether the specified expression contains a reference either direct or indirect to this expression .