protected Object evaluate()

in src/main/org/apache/ant/props/LogicalOperationEvaluator.java [61:85]


    protected Object evaluate(String[] groups, PropertyHelper propertyHelper) {
        boolean result = false;
        String[] or = OR_PATTERN.split(groups[0]);
        for (int o = 0; !result && o < or.length; o++) {
            boolean accumXor = false;
            String[] xor = XOR_PATTERN.split(or[o]);
            for (int x = 0; x < xor.length; x++) {
                boolean accumAnd = true;
                String[] and = AND_PATTERN.split(xor[x]);
                for (int a = 0; accumAnd && a < and.length; a++) {
                    boolean negate = false;
                    String expr = and[a];
                    if (expr.charAt(0) == '!') {
                        negate = true;
                        expr = expr.substring(1);
                    }
                    boolean b = Boolean.valueOf(expr.trim().toLowerCase()).booleanValue() ^ negate;
                    accumAnd &= b;
                }
                accumXor ^= accumAnd;
            }
            result |= accumXor;
        }
        return Boolean.valueOf(result);
    }