1 2 3 package net.sourceforge.pmd.ast; 4 5 public class ASTPrimarySuffix extends SimpleJavaNode { 6 public ASTPrimarySuffix(int id) { 7 super(id); 8 } 9 10 public ASTPrimarySuffix(JavaParser p, int id) { 11 super(p, id); 12 } 13 14 private boolean isArguments; 15 private boolean isArrayDereference; 16 17 public void setIsArrayDereference() { 18 isArrayDereference = true; 19 } 20 21 public boolean isArrayDereference() { 22 return isArrayDereference; 23 } 24 25 public void setIsArguments() { 26 this.isArguments = true; 27 } 28 29 public boolean isArguments() { 30 return this.isArguments; 31 } 32 33 public int getArgumentCount() { 34 if (!this.isArguments()) { 35 throw new RuntimeException ("ASTPrimarySuffix.getArgumentCount called, but this is not a method call"); 36 } 37 return ((ASTArguments)this.getFirstChildOfType(ASTArguments.class)).getArgumentCount(); 38 } 39 40 public void dump(String prefix) { 41 String out = ""; 42 if (isArrayDereference()) { 43 out += ":["; 44 } 45 if (this.getImage() != null) { 46 out += out.length() == 0 ? ":" + this.getImage() : this.getImage(); 47 } 48 System.out.println(toString(prefix) + out); 49 dumpChildren(prefix); 50 } 51 52 55 public Object jjtAccept(JavaParserVisitor visitor, Object data) { 56 return visitor.visit(this, data); 57 } 58 } 59 | Popular Tags |