1 19 20 package soot.shimple.internal; 21 22 import soot.*; 23 import soot.util.*; 24 import soot.shimple.*; 25 import soot.toolkits.scalar.*; 26 import java.util.*; 27 28 31 public class SPiExpr implements PiExpr 32 { 33 protected ValueUnitPair argBox; 34 protected Object targetKey; 35 36 public SPiExpr(Value v, Unit u, Object o) 37 { 38 argBox = new SValueUnitPair(v, u); 39 this.targetKey = o; 40 } 41 42 public ValueUnitPair getArgBox() 43 { 44 return argBox; 45 } 46 47 public Value getValue() 48 { 49 return argBox.getValue(); 50 } 51 52 public Unit getCondStmt() 53 { 54 return argBox.getUnit(); 55 } 56 57 public Object getTargetKey() 58 { 59 return targetKey; 60 } 61 62 public void setValue(Value value) 63 { 64 argBox.setValue(value); 65 } 66 67 public void setCondStmt(Unit pred) 68 { 69 argBox.setUnit(pred); 70 } 71 72 public void setTargetKey(Object targetKey) 73 { 74 this.targetKey = targetKey; 75 } 76 77 public List getUnitBoxes() 78 { 79 return Collections.singletonList(argBox); 80 } 81 82 public void clearUnitBoxes() 83 { 84 System.out.println("clear unit boxes"); 85 argBox.setUnit(null); 86 } 87 88 public boolean equivTo(Object o) 89 { 90 if(!(o instanceof SPiExpr)) 91 return false; 92 93 return getArgBox().equivTo(((SPiExpr)o).getArgBox()); 94 } 95 96 public int equivHashCode() 97 { 98 return getArgBox().equivHashCode() * 17; 99 } 100 101 public void apply(Switch sw) 102 { 103 throw new RuntimeException ("Not Yet Implemented."); 105 } 106 107 public Object clone() 108 { 109 return new SPiExpr(getValue(), getCondStmt(), getTargetKey()); 110 } 111 112 public String toString() 113 { 114 String s = Shimple.PI + "(" + getValue() + ")"; 115 return s; 116 } 117 118 public void toString(UnitPrinter up) 119 { 120 up.literal(Shimple.PI); 121 up.literal("("); 122 argBox.toString(up); 123 up.literal(" ["); 124 up.literal(targetKey.toString()); 125 up.literal("])"); 126 } 127 128 public Type getType() 129 { 130 return getValue().getType(); 131 } 132 133 public List getUseBoxes() 134 { 135 return Collections.singletonList(argBox); 136 } 137 } 138 139 | Popular Tags |