1 19 20 package soot.dava.toolkits.base.renamer; 21 22 import java.util.*; 23 import soot.*; 24 25 public class heuristicSet { 26 HashMap set; 27 28 public heuristicSet() { 29 set = new HashMap(); 30 } 31 32 private heuristicTuple getTuple(Local var) { 33 return (heuristicTuple) set.get(var); 34 } 35 36 public void add(Local var, int bits) { 37 heuristicTuple temp = new heuristicTuple(bits); 38 set.put(var, temp); 39 } 40 41 public void addCastString(Local var, String castString){ 42 heuristicTuple retrieved = getTuple(var); 43 retrieved.addCastString(castString); 44 } 45 46 public List getCastStrings(Local var){ 47 heuristicTuple retrieved = getTuple(var); 48 return retrieved.getCastStrings(); 49 } 50 51 public void setFieldName(Local var, String fieldName) { 52 heuristicTuple retrieved = getTuple(var); 53 retrieved.setFieldName(fieldName); 54 } 55 56 public List getFieldName(Local var) { 57 heuristicTuple retrieved = getTuple(var); 58 return retrieved.getFieldName(); 59 } 60 61 public void setObjectClassName(Local var, String objectClassName) { 62 heuristicTuple retrieved = getTuple(var); 63 retrieved.setObjectClassName(objectClassName); 64 } 65 66 public List getObjectClassName(Local var) { 67 heuristicTuple retrieved = getTuple(var); 68 return retrieved.getObjectClassName(); 69 } 70 71 public void setMethodName(Local var, String methodName) { 72 heuristicTuple retrieved = getTuple(var); 73 retrieved.setMethodName(methodName); 74 } 75 76 public List getMethodName(Local var) { 77 heuristicTuple retrieved = getTuple(var); 78 return retrieved.getMethodName(); 79 } 80 81 public void setHeuristic(Local var, int bitIndex) { 82 heuristicTuple retrieved = getTuple(var); 83 retrieved.setHeuristic(bitIndex); 84 } 85 86 public boolean getHeuristic(Local var, int bitIndex) { 87 heuristicTuple retrieved = getTuple(var); 88 return retrieved.getHeuristic(bitIndex); 89 } 90 91 public boolean isAnyHeuristicSet(Local var) { 92 heuristicTuple retrieved = getTuple(var); 93 return retrieved.isAnyHeuristicSet(); 94 } 95 96 public void print() { 97 Iterator it = set.keySet().iterator(); 98 while (it.hasNext()) { 99 Object local = it.next(); 100 heuristicTuple temp = (heuristicTuple) set.get(local); 101 String tuple = temp.getPrint(); 102 System.out.println(local + " " + tuple + " DefinedType: " 103 + ((Local) local).getType()); 104 } 105 } 106 107 public Iterator getLocalsIterator() { 108 return set.keySet().iterator(); 109 } 110 111 public boolean contains(Local var){ 112 if(set.get(var) != null) 113 return true; 114 else 115 return false; 116 } 117 } | Popular Tags |