1 19 20 package soot.dava.toolkits.base.renamer; 21 22 import soot.*; 23 import java.util.*; 24 25 public class heuristicTuple{ 26 BitSet heuristics; 27 int bitSetSize; 28 Vector methodName; Vector objectClassName; Vector fieldName; Vector castStrings; 33 public heuristicTuple(int bits){ 34 heuristics =new BitSet(bits); 35 this.methodName= new Vector(); 36 this.objectClassName = new Vector(); 37 this.fieldName = new Vector(); 38 this.castStrings = new Vector(); 39 bitSetSize=bits; 40 } 41 42 public void addCastString(String castString){ 43 this.castStrings.add(castString); 44 setHeuristic(infoGatheringAnalysis.CAST); 45 } 46 47 public List getCastStrings(){ 48 return castStrings; 49 } 50 51 public void setFieldName(String fieldName){ 52 this.fieldName.add(fieldName); 53 setHeuristic(infoGatheringAnalysis.FIELDASSIGN); 54 } 55 56 public List getFieldName(){ 57 return fieldName; 58 } 59 60 public void setObjectClassName(String objectClassName){ 61 this.objectClassName.add(objectClassName); 62 setHeuristic(infoGatheringAnalysis.CLASSNAME); 63 } 64 65 public List getObjectClassName(){ 66 return objectClassName; 67 } 68 69 public void setMethodName(String methodName){ 70 this.methodName.add(methodName); 71 setHeuristic(infoGatheringAnalysis.METHODNAME); 72 if(methodName.startsWith("get") || methodName.startsWith("set")) 73 setHeuristic(infoGatheringAnalysis.GETSET); 74 } 75 76 public List getMethodName(){ 77 return methodName; 78 } 79 80 public void setHeuristic(int bitIndex){ 81 heuristics.set(bitIndex); 82 } 83 84 public boolean getHeuristic(int bitIndex){ 85 return heuristics.get(bitIndex); 86 } 87 88 public boolean isAnyHeuristicSet(){ 89 return !heuristics.isEmpty(); 90 } 91 92 93 public String getPrint(){ 94 String temp ="BitSet: "; 95 for(int i=0;i<bitSetSize;i++){ 96 if(getHeuristic(i)) temp=temp.concat("1"); 98 else 99 temp=temp.concat("0"); 100 } 101 102 temp=temp.concat(" Field: "+fieldName.toString()); 103 104 temp=temp.concat(" Method: "); 105 Iterator it = getMethodName().iterator(); 106 while(it.hasNext()){ 107 temp = temp.concat((String )it.next()+" , "); 108 } 109 110 temp=temp.concat(" Class: "+objectClassName.toString()); 111 112 return temp; 114 } 115 116 } | Popular Tags |