1 11 package org.eclipse.pde.internal.build.ant; 12 13 import java.util.*; 14 15 18 public class Condition { 19 20 23 protected String type; 24 public static final String TYPE_AND = "and"; protected List singleConditions; 26 protected List nestedConditions; 27 28 31 public Condition() { 32 this.singleConditions = new ArrayList(5); 33 this.nestedConditions = new ArrayList(5); 34 } 35 36 public Condition(String type) { 37 this(); 38 this.type = type; 39 } 40 41 46 protected void print(AntScript script) { 47 if (type != null) { 48 script.indent++; 49 script.printStartTag(type); 50 } 51 for (Iterator iterator = singleConditions.iterator(); iterator.hasNext();) 52 script.printString((String ) iterator.next()); 53 for (Iterator iterator = nestedConditions.iterator(); iterator.hasNext();) { 54 Condition condition = (Condition) iterator.next(); 55 condition.print(script); 56 } 57 if (type != null) { 58 script.printEndTag(type); 59 script.indent--; 60 } 61 } 62 63 69 public void addEquals(String arg1, String arg2) { 70 StringBuffer condition = new StringBuffer (); 71 condition.append("<equals "); condition.append("arg1=\""); condition.append(arg1); 74 condition.append("\" "); condition.append("arg2=\""); condition.append(arg2); 77 condition.append("\"/>"); singleConditions.add(condition.toString()); 79 } 80 81 86 public void add(Condition condition) { 87 nestedConditions.add(condition); 88 } 89 90 } 91 | Popular Tags |