1 26 package net.sf.javaguard; 27 28 29 import net.sf.javaguard.classfile.ClassFile; 30 31 32 38 public class TreeItem { 39 40 private boolean isSynthetic; 41 42 private int access; 43 44 private ClassTree classTree = null; 45 46 private TreeItem parent = null; 47 48 49 private String separator = ClassFile.SEP_REGULAR; 50 51 private String inName = null; 52 53 private String outName = null; 54 55 private boolean isFixed = false; 56 57 private boolean isFromScript = false; 58 59 private boolean isFromScriptMap = false; 60 61 63 private boolean ignoreElement; 64 65 66 private boolean forceObfuscate; 67 68 69 private boolean scriptEntryMatch; 70 71 72 73 74 78 public TreeItem(TreeItem parent, String name) { 79 setParent(parent); 80 this.inName = name; 81 if (null != getParent()) { 82 classTree = getParent().getClassTree(); 83 } 84 setIgnoreElement(false); 85 setForceObfuscate(false); 86 setScriptEntryMatch(false); 87 } 88 89 90 91 92 96 protected void setModifiers(int access) { 97 this.access = access; 98 } 99 100 101 105 public int getModifiers() { 106 return access; 107 } 108 109 110 111 112 115 public String getInName() { 116 return inName; 117 } 118 119 120 123 public String getFullInName() { 124 if (null == getParent()) { 125 return ""; 126 } else if (null == getParent().getParent()) { 127 return getInName(); 128 } else { 129 return getParent().getFullInName() + getSeparator() + getInName(); 130 } 131 } 132 133 134 137 public String getFullOutName() { 138 if (null == getParent()) { 139 return ""; 140 } else if (getParent().getParent() == null) { 141 return getOutName(); 142 } else { 143 return getParent().getFullOutName() + getSeparator() + getOutName(); 144 } 145 } 146 147 148 149 150 153 public void setOutName(String outName) { 154 this.outName = outName; 155 isFixed = true; 156 } 157 158 161 public String getOutName() { 162 if (null != outName) { 163 return outName; 164 } 165 return getInName(); 166 } 167 168 169 172 public String getObfName() { 173 return outName; 174 } 175 176 177 178 179 181 public void setFromScript() { 182 isFromScript = true; 183 } 184 185 186 190 public boolean isFromScript() { 191 return isFromScript; 192 } 193 194 195 196 197 200 public void setFromScriptMap() { 201 isFromScriptMap = true; 202 } 203 204 205 210 public boolean isFromScriptMap() { 211 return isFromScriptMap; 212 } 213 214 215 216 217 220 public boolean isFixed() { 221 return isFixed; 222 } 223 224 225 226 227 231 protected void setSynthetic(boolean synthetic) { 232 this.isSynthetic = synthetic; 233 } 234 235 236 240 public boolean isSynthetic() { 241 return isSynthetic; 242 } 243 244 245 246 247 251 public void setParent(TreeItem parent) { 252 this.parent = parent; 253 } 254 255 256 259 public TreeItem getParent() { 260 return parent; 261 } 262 263 264 265 266 271 public void setIgnoreElement(boolean ignore) { 272 this.ignoreElement = ignore; 273 } 274 275 280 public boolean canIgnoreElement() { 281 return ignoreElement; 282 } 283 284 285 286 287 291 public void setForceObfuscate(boolean force) { 292 this.forceObfuscate = force; 293 } 294 295 299 public boolean canForceObfuscate() { 300 return forceObfuscate; 301 } 302 303 304 305 306 311 protected void setClassTree(ClassTree ct) { 312 this.classTree = ct; 313 } 314 315 316 321 protected ClassTree getClassTree() { 322 if (null == classTree) { 323 if (null != getParent()) { 324 setClassTree(getParent().getClassTree()); 325 } 326 } 327 return classTree; 328 } 329 330 331 332 333 337 protected void setSeparator(String separator) { 338 this.separator = separator; 339 } 340 341 342 346 public String getSeparator() { 347 return separator; 348 } 349 350 351 352 353 357 public void setScriptEntryMatch(boolean match) { 358 this.scriptEntryMatch = match; 359 } 360 361 362 365 public boolean isScriptEntryMatch() { 366 return scriptEntryMatch; 367 } 368 } 369 | Popular Tags |