1 24 25 package org.aspectj.compiler.crosscuts.ast; 26 27 import org.aspectj.compiler.base.ast.*; 28 import org.aspectj.compiler.base.JavaCompiler; 29 34 35 public abstract class BinaryPcd extends Pcd { 36 abstract protected String getSymbol(); 37 38 public String toShortString() { 39 return getPcd1().toShortString() + " " + getSymbol() + " " + 40 getPcd2().toShortString(); 41 } 42 43 public void checkStatic() { getPcd1().checkStatic(); getPcd2().checkStatic(); } 44 45 49 protected Pcd pcd1; 51 public Pcd getPcd1() { return pcd1; } 52 public void setPcd1(Pcd _pcd1) { 53 if (_pcd1 != null) _pcd1.setParent(this); 54 pcd1 = _pcd1; 55 } 56 57 protected Pcd pcd2; 58 public Pcd getPcd2() { return pcd2; } 59 public void setPcd2(Pcd _pcd2) { 60 if (_pcd2 != null) _pcd2.setParent(this); 61 pcd2 = _pcd2; 62 } 63 64 public BinaryPcd(SourceLocation location, Pcd _pcd1, Pcd _pcd2) { 65 super(location); 66 setPcd1(_pcd1); 67 setPcd2(_pcd2); 68 } 69 protected BinaryPcd(SourceLocation source) { 70 super(source); 71 } 72 73 public ASTObject getChildAt(int childIndex) { 74 switch(childIndex) { 75 case 0: return pcd1; 76 case 1: return pcd2; 77 default: return super.getChildAt(childIndex); 78 } 79 } 80 public String getChildNameAt(int childIndex) { 81 switch(childIndex) { 82 case 0: return "pcd1"; 83 case 1: return "pcd2"; 84 default: return super.getChildNameAt(childIndex); 85 } 86 } 87 public void setChildAt(int childIndex, ASTObject child) { 88 switch(childIndex) { 89 case 0: setPcd1((Pcd)child); return; 90 case 1: setPcd2((Pcd)child); return; 91 default: super.setChildAt(childIndex, child); return; 92 } 93 } 94 public int getChildCount() { 95 return 2; 96 } 97 98 public String getDefaultDisplayName() { 99 return "BinaryPcd()"; 100 } 101 102 } 104 | Popular Tags |