1 15 16 package javassist.compiler.ast; 17 18 import java.io.Serializable ; 19 import javassist.compiler.CompileError; 20 21 26 public abstract class ASTree implements Serializable { 27 public ASTree getLeft() { return null; } 28 29 public ASTree getRight() { return null; } 30 31 public void setLeft(ASTree _left) {} 32 33 public void setRight(ASTree _right) {} 34 35 40 public abstract void accept(Visitor v) throws CompileError; 41 42 public String toString() { 43 StringBuffer sbuf = new StringBuffer (); 44 sbuf.append('<'); 45 sbuf.append(getTag()); 46 sbuf.append('>'); 47 return sbuf.toString(); 48 } 49 50 54 protected String getTag() { 55 String name = getClass().getName(); 56 return name.substring(name.lastIndexOf('.') + 1); 57 } 58 } 59 | Popular Tags |