1 21 package com.izforge.izpack.rules; 22 23 import java.util.List ; 24 import java.util.Properties ; 25 26 import net.n3.nanoxml.XMLElement; 27 import com.izforge.izpack.util.Debug; 28 29 33 public class OrCondition extends Condition 34 { 35 36 public static final String RDE_VCS_REVISION = "$Revision: 1.1 $"; 37 38 public static final String RDE_VCS_NAME = "$Name: $"; 39 40 protected Condition leftoperand; 41 42 protected Condition rightoperand; 43 44 47 public OrCondition() 48 { 49 super(); 50 } 52 53 56 public OrCondition(Condition operand1, Condition operand2) 57 { 58 this.leftoperand = operand1; 59 this.rightoperand = operand2; 60 } 61 62 67 71 76 public void readFromXML(XMLElement xmlcondition) 77 { 78 try 79 { 80 if (xmlcondition.getChildrenCount() != 2) 81 { 82 Debug.log("or-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 or-condition"); 91 } 92 } 93 94 99 public boolean isTrue() 100 { 101 return this.leftoperand.isTrue() || this.rightoperand.isTrue(); 102 } 103 } 104 | Popular Tags |