1 2 3 package soot.jimple.parser.node; 4 5 import java.util.*; 6 import soot.jimple.parser.analysis.*; 7 8 public final class ACaseStmt extends PCaseStmt 9 { 10 private PCaseLabel _caseLabel_; 11 private TColon _colon_; 12 private PGotoStmt _gotoStmt_; 13 14 public ACaseStmt() 15 { 16 } 17 18 public ACaseStmt( 19 PCaseLabel _caseLabel_, 20 TColon _colon_, 21 PGotoStmt _gotoStmt_) 22 { 23 setCaseLabel(_caseLabel_); 24 25 setColon(_colon_); 26 27 setGotoStmt(_gotoStmt_); 28 29 } 30 public Object clone() 31 { 32 return new ACaseStmt( 33 (PCaseLabel) cloneNode(_caseLabel_), 34 (TColon) cloneNode(_colon_), 35 (PGotoStmt) cloneNode(_gotoStmt_)); 36 } 37 38 public void apply(Switch sw) 39 { 40 ((Analysis) sw).caseACaseStmt(this); 41 } 42 43 public PCaseLabel getCaseLabel() 44 { 45 return _caseLabel_; 46 } 47 48 public void setCaseLabel(PCaseLabel node) 49 { 50 if(_caseLabel_ != null) 51 { 52 _caseLabel_.parent(null); 53 } 54 55 if(node != null) 56 { 57 if(node.parent() != null) 58 { 59 node.parent().removeChild(node); 60 } 61 62 node.parent(this); 63 } 64 65 _caseLabel_ = node; 66 } 67 68 public TColon getColon() 69 { 70 return _colon_; 71 } 72 73 public void setColon(TColon node) 74 { 75 if(_colon_ != null) 76 { 77 _colon_.parent(null); 78 } 79 80 if(node != null) 81 { 82 if(node.parent() != null) 83 { 84 node.parent().removeChild(node); 85 } 86 87 node.parent(this); 88 } 89 90 _colon_ = node; 91 } 92 93 public PGotoStmt getGotoStmt() 94 { 95 return _gotoStmt_; 96 } 97 98 public void setGotoStmt(PGotoStmt node) 99 { 100 if(_gotoStmt_ != null) 101 { 102 _gotoStmt_.parent(null); 103 } 104 105 if(node != null) 106 { 107 if(node.parent() != null) 108 { 109 node.parent().removeChild(node); 110 } 111 112 node.parent(this); 113 } 114 115 _gotoStmt_ = node; 116 } 117 118 public String toString() 119 { 120 return "" 121 + toString(_caseLabel_) 122 + toString(_colon_) 123 + toString(_gotoStmt_); 124 } 125 126 void removeChild(Node child) 127 { 128 if(_caseLabel_ == child) 129 { 130 _caseLabel_ = null; 131 return; 132 } 133 134 if(_colon_ == child) 135 { 136 _colon_ = null; 137 return; 138 } 139 140 if(_gotoStmt_ == child) 141 { 142 _gotoStmt_ = null; 143 return; 144 } 145 146 } 147 148 void replaceChild(Node oldChild, Node newChild) 149 { 150 if(_caseLabel_ == oldChild) 151 { 152 setCaseLabel((PCaseLabel) newChild); 153 return; 154 } 155 156 if(_colon_ == oldChild) 157 { 158 setColon((TColon) newChild); 159 return; 160 } 161 162 if(_gotoStmt_ == oldChild) 163 { 164 setGotoStmt((PGotoStmt) newChild); 165 return; 166 } 167 168 } 169 } 170 | Popular Tags |