1 21 package com.izforge.izpack.rules; 22 23 import net.n3.nanoxml.XMLElement; 24 25 import com.izforge.izpack.util.Debug; 26 27 31 public class XOrCondition extends OrCondition 32 { 33 34 37 public XOrCondition() 38 { 39 super(); 40 } 42 43 47 public XOrCondition(Condition operand1, Condition operand2) 48 { 49 super(operand1, operand2); 50 } 51 52 57 71 76 public void readFromXML(XMLElement xmlcondition) 77 { 78 try 79 { 80 if (xmlcondition.getChildrenCount() != 2) 81 { 82 Debug.log("xor-condition needs two conditions as operands"); 83 return; 84 } 85 this.leftoperand = RulesEngine.analyzeCondition(xmlcondition.getChildAtIndex(0)); 86 this.rightoperand = RulesEngine.analyzeCondition(xmlcondition.getChildAtIndex(1)); 87 } 88 catch (Exception e) 89 { 90 Debug.log("missing element in xor-condition"); 91 } 92 } 93 94 public boolean isTrue() 95 { 96 boolean op1true = leftoperand.isTrue(); 97 boolean op2true = rightoperand.isTrue(); 98 99 if (op1true && op2true) 100 { 101 return false; 103 } 104 return op1true || op2true; 105 } 106 107 121 } 122 | Popular Tags |