| 1 28 29 package com.idaremedia.antx.condition; 30 31 import java.util.Iterator ; 32 33 import org.apache.tools.ant.Project; 34 35 import com.idaremedia.antx.AntX; 36 import com.idaremedia.antx.ExportedProperties; 37 import com.idaremedia.antx.FlexString; 38 import com.idaremedia.antx.helpers.Strings; 39 import com.idaremedia.antx.helpers.Tk; 40 import com.idaremedia.antx.parameters.Handling; 41 42 65 66 public class AnySet extends CheckSetCondition implements URIable 67 { 68 72 public AnySet() 73 { 74 super(AntX.rules+"anyset"); 75 } 76 77 78 79 84 public AnySet(String properties,Project P) 85 { 86 super(AntX.rules+"anyset",properties,P); 87 } 88 89 90 91 95 public boolean eval() 96 { 97 verifyInProject_("eval"); 98 99 final Project P = getProject(); 100 boolean istrue = false; 102 if (!getIncludes().isEmpty()) { 103 104 boolean ignoreWS = ignoreWhitespace(); 105 boolean iffTrue = isTruesOnly(); 106 boolean checkUnresolved = getMalformedHandling()==Handling.REJECT; 107 Iterator itr = getIncludesIterator(); 108 109 while (itr.hasNext()) { 110 FlexString xv = (FlexString)itr.next(); 111 String v = null; 112 113 if (xv.isProperty() && checkUnresolved) { 114 if (LocalPropertyExaminer.verifyProperty(P, xv)) { 115 v = xv.getValue(P); 116 } 117 } else { 118 v = xv.getValue(P); 119 } 120 if (v!=null) { 121 if (ignoreWS && Tk.isWhitespace(v)) { 122 v = null; 123 } else if (iffTrue && Tk.string2PosBool(v)!=Boolean.TRUE) { 124 v = null; 125 } 126 } 127 if (v!=null) { 128 istrue=true; 129 break; 130 } 131 } 132 } 133 134 if (istrue && getUpdateProperty()!=null) { 135 String what = Strings.TRUE; 136 if (isUpdateVariable()) { 137 ExportedProperties.set(getUpdateProperty(),what); 138 } else { 139 getProject().setNewProperty(getUpdateProperty(),what); 140 } 141 } 142 143 return istrue; 144 } 145 146 147 148 154 public void xsetFromURI(String fragment) 155 { 156 xsetFromURIFragment(fragment); 157 } 158 } 159 160 161 | Popular Tags |