1 28 29 package com.idaremedia.antx.go; 30 31 import java.util.Iterator ; 32 import java.util.List ; 33 34 import org.apache.tools.ant.Project; 35 36 import com.idaremedia.antx.helpers.Tk; 37 38 53 54 public final class IffAny 55 { 56 64 public static boolean pass(String list, Project P, boolean onlyIfTrue) 65 { 66 if (Tk.isWhitespace(list)) { 67 return false; 68 } 69 List l= Tk.splitList(list); 70 Iterator itr= l.iterator(); 71 while (itr.hasNext()) { 72 if (Iff.allowed(itr.next().toString(),P,onlyIfTrue)) { 73 return true; 74 } 75 } 76 return false; 77 } 78 79 80 89 public static final class Exists extends Go.TestSkeleton { 90 public Exists() { 91 } 92 public Exists(String list) { 93 super(list); 94 } 95 public boolean pass(Project P) { 96 verifyInited(); 97 return IffAny.pass(getParameter(),P,false); 98 } 99 public String getParameterName() { 100 return "ifAny"; 101 } 102 } 103 104 105 114 public static final class NotExists extends Go.TestSkeleton { 115 public NotExists() { 116 } 117 public NotExists(String list) { 118 super(list); 119 } 120 public boolean pass(Project P) { 121 verifyInited(); 122 return !IffAny.pass(getParameter(),P,false); 123 } 124 public String getParameterName() { 125 return "unlessAny"; 126 } 127 } 128 129 130 139 public static final class IsTrue extends Go.TestSkeleton { 140 public IsTrue() { 141 } 142 public IsTrue(String list) { 143 super(list); 144 } 145 public boolean pass(Project P) { 146 verifyInited(); 147 return IffAny.pass(getParameter(),P,true); 148 } 149 public String getParameterName() { 150 return "ifAnyTrue"; 151 } 152 } 153 154 155 164 public static final class IsNotTrue extends Go.TestSkeleton { 165 public IsNotTrue() { 166 } 167 public IsNotTrue(String list) { 168 super(list); 169 } 170 public boolean pass(Project P) { 171 verifyInited(); 172 return !IffAny.pass(getParameter(),P,true); 173 } 174 public String getParameterName() { 175 return "unlessAnyTrue"; 176 } 177 } 178 179 180 183 private IffAny() { 184 } 185 } 186 187 188 | Popular Tags |