1 21 22 package com.izforge.izpack.rules; 23 24 import java.util.List ; 25 import java.util.Properties ; 26 27 import net.n3.nanoxml.XMLElement; 28 import com.izforge.izpack.util.Debug; 29 30 35 public class AndCondition extends Condition 36 { 37 38 protected Condition leftoperand; 39 40 protected Condition rightoperand; 41 42 45 public AndCondition() 46 { 47 super(); 48 } 49 50 53 public AndCondition(Condition operand1, Condition operand2) 54 { 55 this.leftoperand = operand1; 56 this.rightoperand = operand2; 57 } 58 59 64 70 71 76 public void readFromXML(XMLElement xmlcondition) 77 { 78 try 79 { 80 if (xmlcondition.getChildrenCount() != 2) 81 { 82 Debug.log("and-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 and-condition"); 91 } 92 } 93 94 101 public boolean isTrue() 102 { 103 return leftoperand.isTrue() && rightoperand.isTrue(); 104 } 105 } 106 | Popular Tags |