1 19 20 21 package ca.mcgill.sable.soot.editors.parser; 22 23 import java.util.*; 24 25 public class JimpleBody { 26 27 private String text; 28 private ArrayList textArr; 29 private ArrayList methods; 30 private ArrayList fields; 31 32 33 public JimpleBody(String text, ArrayList textArr){ 34 setText(text); 35 setTextArr(textArr); 36 } 37 38 public boolean isJimpleBody() { 39 40 return true; 41 } 42 43 44 public void parseBody(){ 45 46 setFields(new ArrayList()); 50 setMethods(new ArrayList()); 51 52 Iterator it = getTextArr().iterator(); 53 int counter = 0; 54 boolean inMethod = false; 55 while (it.hasNext()){ 56 String temp = (String )it.next(); 57 if ((temp.trim().equals("}")) && (inMethod)){ 58 inMethod = false; 59 } 60 if (!inMethod){ 61 if (counter < 2){ 62 } 63 else if (JimpleField.isField(temp)){ 64 getFields().add(temp); 65 } 66 else if (JimpleMethod.isMethod(temp)){ 67 getMethods().add(temp); 68 if (temp.indexOf(";") != -1){ 69 } 70 else{ 71 inMethod = true; 72 } 73 } 74 } 75 counter++; 76 } 77 78 } 79 80 83 public String getText() { 84 return text; 85 } 86 87 91 public void setText(String text) { 92 this.text = text; 93 } 94 95 98 public ArrayList getTextArr() { 99 return textArr; 100 } 101 102 105 public void setTextArr(ArrayList list) { 106 textArr = list; 107 } 108 109 112 public void setFields(ArrayList list) { 113 fields = list; 114 } 115 116 119 public void setMethods(ArrayList list) { 120 methods = list; 121 } 122 123 126 public ArrayList getFields() { 127 return fields; 128 } 129 130 133 public ArrayList getMethods() { 134 return methods; 135 } 136 137 } 138 | Popular Tags |