1 19 20 package soot.toolkits.astmetrics; 21 22 import java.awt.List ; 23 import java.util.ArrayList ; 24 import java.util.Iterator ; 25 26 27 32 public class ClassData { 33 String className; ArrayList metricData; 36 public ClassData(String name){ 37 className=name; 38 metricData = new ArrayList (); 39 } 40 41 public String getClassName(){ 42 return className; 43 } 44 45 49 public boolean classNameEquals(String className){ 50 return (this.className.equals(className)); 51 } 52 53 54 58 public void addMetric(MetricData data){ 59 Iterator it = metricData.iterator(); 60 while(it.hasNext()){ 61 MetricData temp = (MetricData)it.next(); 62 if(temp.metricName.equals(data.metricName)){ 63 return; 65 } 66 } 67 metricData.add(data); 68 } 69 70 71 public String toString(){ 72 StringBuffer b = new StringBuffer (); 73 b.append("<Class>\n"); 74 b.append("<ClassName>" + className + "</ClassName>\n"); 75 Iterator it = metricData.iterator(); 76 while(it.hasNext()){ 77 b.append(((MetricData)it.next()).toString()); 78 } 79 b.append("</Class>"); 80 return b.toString(); 81 } 82 } 83 | Popular Tags |