1 20 21 package soot.dava.internal.asg; 22 import soot.*; 23 24 import java.util.*; 25 import soot.util.*; 26 import soot.jimple.*; 27 import soot.dava.internal.SET.*; 28 29 30 public class AugmentedStmt 31 { 32 public List bpreds, bsuccs, cpreds, csuccs; 33 public SETNode myNode; 34 35 private IterableSet dominators, reachers; 36 private Stmt s; 37 38 39 public AugmentedStmt( Stmt s) 40 { 41 this.s = s; 42 43 dominators = new IterableSet(); 44 reachers = new IterableSet(); 45 46 reset_PredsSuccs(); 47 } 48 49 public void set_Stmt( Stmt s) 50 { 51 this.s = s; 52 } 53 54 public boolean add_BPred( AugmentedStmt bpred) 55 { 56 if (add_CPred( bpred) == false) 57 return false; 58 59 if (bpreds.contains( bpred)) { 60 cpreds.remove( bpred); 61 return false; 62 } 63 64 bpreds.add( bpred); 65 return true; 66 } 67 68 public boolean add_BSucc( AugmentedStmt bsucc) 69 { 70 if (add_CSucc( bsucc) == false) 71 return false; 72 73 if (bsuccs.contains( bsucc)) { 74 csuccs.remove( bsucc); 75 return false; 76 } 77 78 bsuccs.add( bsucc); 79 return true; 80 } 81 82 public boolean add_CPred( AugmentedStmt cpred) 83 { 84 if (cpreds.contains( cpred) == false) { 85 cpreds.add( cpred); 86 return true; 87 } 88 89 return false; 90 } 91 92 public boolean add_CSucc( AugmentedStmt csucc) 93 { 94 if (csuccs.contains( csucc) == false) { 95 csuccs.add( csucc); 96 return true; 97 } 98 99 return false; 100 } 101 102 public boolean remove_BPred( AugmentedStmt bpred) 103 { 104 if (remove_CPred( bpred) == false) 105 return false; 106 107 if (bpreds.contains( bpred)) { 108 bpreds.remove( bpred); 109 return true; 110 } 111 112 cpreds.add( bpred); 113 return false; 114 } 115 116 public boolean remove_BSucc( AugmentedStmt bsucc) 117 { 118 if (remove_CSucc( bsucc) == false) 119 return false; 120 121 if (bsuccs.contains( bsucc)) { 122 bsuccs.remove( bsucc); 123 return true; 124 } 125 126 csuccs.add( bsucc); 127 return false; 128 } 129 130 public boolean remove_CPred( AugmentedStmt cpred) 131 { 132 if (cpreds.contains( cpred)) { 133 cpreds.remove( cpred); 134 return true; 135 } 136 137 return false; 138 } 139 140 public boolean remove_CSucc( AugmentedStmt csucc) 141 { 142 if (csuccs.contains( csucc)) { 143 csuccs.remove( csucc); 144 return true; 145 } 146 147 return false; 148 } 149 150 public Stmt get_Stmt() 151 { 152 return s; 153 } 154 155 public IterableSet get_Dominators() 156 { 157 return dominators; 158 } 159 160 public IterableSet get_Reachers() 161 { 162 return reachers; 163 } 164 165 public void set_Reachability( IterableSet reachers) 166 { 167 this.reachers = reachers; 168 } 169 170 public void dump() 171 { 172 G.v().out.println( toString()); 173 } 174 175 public String toString() 176 { 177 return "(" + s.toString() + " @ " + hashCode() + ")"; 178 } 179 180 public void reset_PredsSuccs() 181 { 182 bpreds = new LinkedList(); 183 bsuccs = new LinkedList(); 184 cpreds = new LinkedList(); 185 csuccs = new LinkedList(); 186 } 187 188 public Object clone() 189 { 190 return new AugmentedStmt( (Stmt) s.clone()); 191 } 192 } 193 | Popular Tags |