1 2 3 package net.sourceforge.pmd.ast; 4 5 public class ASTPrimaryPrefix extends SimpleJavaNode { 6 public ASTPrimaryPrefix(int id) { 7 super(id); 8 } 9 10 public ASTPrimaryPrefix(JavaParser p, int id) { 11 super(p, id); 12 } 13 14 private boolean usesThisModifier; 15 private boolean usesSuperModifier; 16 17 public void setUsesThisModifier() { 18 usesThisModifier = true; 19 } 20 21 public boolean usesThisModifier() { 22 return this.usesThisModifier; 23 } 24 25 public void setUsesSuperModifier() { 26 usesSuperModifier = true; 27 } 28 29 public boolean usesSuperModifier() { 30 return this.usesSuperModifier; 31 } 32 33 public String getLabel() { 34 String out = getImage(); 35 if (usesSuperModifier) { 36 return "super." + out; 37 } else if (usesThisModifier) { 38 if (getImage() == null) { 39 return "this"; 40 } else { 41 return "this." + out; 42 } 43 } 44 return out; 45 } 46 47 public void dump(String prefix) { 48 String out = getImage(); 49 if (usesSuperModifier) { 50 out = "super." + out; 51 } else if (usesThisModifier) { 52 if (getImage() == null) { 53 out = "this"; 54 } else { 55 out = "this." + out; 56 } 57 } 58 59 if (out == null) { 60 System.out.println(toString(prefix)); 61 } else { 62 System.out.println(toString(prefix) + ":" + out); 63 } 64 dumpChildren(prefix); 65 } 66 67 70 public Object jjtAccept(JavaParserVisitor visitor, Object data) { 71 return visitor.visit(this, data); 72 } 73 } 74 | Popular Tags |