1 19 20 25 26 27 package soot.jimple.internal; 28 29 import soot.*; 30 import soot.jimple.*; 31 import soot.util.*; 32 import java.util.*; 33 34 public abstract class AbstractInstanceOfExpr implements InstanceOfExpr 35 { 36 ValueBox opBox; 37 Type checkType; 38 39 protected AbstractInstanceOfExpr(ValueBox opBox, Type checkType) 40 { 41 this.opBox = opBox; this.checkType = checkType; 42 } 43 44 public boolean equivTo(Object o) 45 { 46 if (o instanceof AbstractInstanceOfExpr) 47 { 48 AbstractInstanceOfExpr aie = (AbstractInstanceOfExpr)o; 49 return opBox.getValue().equivTo(aie.opBox.getValue()) && 50 checkType.equals(aie.checkType); 51 } 52 return false; 53 } 54 55 56 public int equivHashCode() 57 { 58 return opBox.getValue().equivHashCode() * 101 + checkType.hashCode() * 17; 59 } 60 61 public abstract Object clone(); 62 63 public String toString() 64 { 65 return opBox.getValue().toString() + " " + Jimple.v().INSTANCEOF + " " + checkType.toString(); 66 } 67 68 public void toString( UnitPrinter up ) { 69 opBox.toString(up); 70 up.literal(" "); 71 up.literal(Jimple.v().INSTANCEOF); 72 up.literal(" "); 73 up.type(checkType); 74 } 75 76 public Value getOp() 77 { 78 return opBox.getValue(); 79 } 80 81 public void setOp(Value op) 82 { 83 opBox.setValue(op); 84 } 85 86 public ValueBox getOpBox() 87 { 88 return opBox; 89 } 90 91 public List getUseBoxes() 92 { 93 List list = new ArrayList(); 94 95 list.addAll(opBox.getValue().getUseBoxes()); 96 list.add(opBox); 97 98 return list; 99 } 100 101 public Type getType() 102 { 103 return BooleanType.v(); 104 } 105 106 public Type getCheckType() 107 { 108 return checkType; 109 } 110 111 public void setCheckType(Type checkType) 112 { 113 this.checkType = checkType; 114 } 115 116 public void apply(Switch sw) 117 { 118 ((ExprSwitch) sw).caseInstanceOfExpr(this); 119 } 120 } 121 | Popular Tags |