1 11 package org.eclipse.pde.internal.build.tasks; 12 13 public class Config { 14 15 public static String ANY = "*"; private String ws; 17 private String os; 18 private String arch; 19 20 private static Config genericConfig; 22 public Config(String os, String ws, String arch) { 23 this.ws = ws; 24 this.os = os; 25 this.arch = arch; 26 } 27 28 public Config(String [] config) { 29 this(config[0], config[1], config[2]); 30 } 31 32 public String getArch() { 33 return arch; 34 } 35 36 public String getOs() { 37 return os; 38 } 39 40 public String getWs() { 41 return ws; 42 } 43 44 public boolean equals(Object config) { 45 if (this == config) 46 return true; 47 48 if (!(config instanceof Config)) 49 return false; 50 51 Config aConfig = (Config) config; 52 if (!os.equalsIgnoreCase(aConfig.os)) 53 return false; 54 55 if (!ws.equalsIgnoreCase(aConfig.ws)) 56 return false; 57 58 if (!arch.equalsIgnoreCase(aConfig.arch)) 59 return false; 60 61 return true; 62 } 63 64 public int hashCode() { 65 return os.hashCode() + ws.hashCode() + arch.hashCode(); 66 } 67 68 public String toString() { 69 return toString("_"); } 71 72 public String toString(String separator) { 73 return os + separator + ws + separator + arch; 74 } 75 76 public String toStringReplacingAny(String separator, String value) { 77 if (value == null) { 78 return ""; } 80 81 String newOs = os; 82 String newWs = ws; 83 String newArch = arch; 84 85 if (os == ANY) 86 newOs = value; 87 if (ws == ANY) 88 newWs = value; 89 if (arch == ANY) 90 newArch = value; 91 92 return newOs + separator + newWs + separator + newArch; 93 } 94 95 public static Config genericConfig() { 96 if (genericConfig == null) 97 genericConfig = new Config(ANY, ANY, ANY); 98 99 return genericConfig; 100 } 101 102 } 103 | Popular Tags |