FileDocCategorySizeDatePackage
Xor.javaAPI DocApache Ant 1.701701Wed Dec 13 06:16:20 GMT 2006org.apache.tools.ant.taskdefs.condition

Xor

public class Xor extends ConditionBase implements Condition
The Xor condition type to exclusive or operations. This does not shortcut stuff.

Fields Summary
Constructors Summary
Methods Summary
public booleaneval()
Evaluate the contained conditions.

return
the result of xoring the conditions together.
throws
org.apache.tools.ant.BuildException if an error occurs.

        Enumeration e = getConditions();
        //initial state is false.
        boolean state = false;
        while (e.hasMoreElements()) {
            Condition c = (Condition) e.nextElement();
            //every condition is xored against the previous one
            state ^= c.eval();
        }
        return state;