1 26 package org.hammurapi.inspectors.metrics.callertrace; 27 28 import java.util.HashSet ; 29 30 import org.w3c.dom.Document ; 31 import org.w3c.dom.Element ; 32 33 import com.pavelvlasov.jsel.OperationInfo; 34 import com.pavelvlasov.review.SourceMarker; 35 36 42 public class MethodWrapperDeclaration extends MethodWrapperImpl implements MethodWrapper { 43 private boolean called = false; 44 private HashSet invokedMethods = new HashSet (); 45 public int afferentMethodCoupling = 0; 46 public int efferentMethodCoupling = 0; 47 48 49 public MethodWrapperDeclaration(OperationInfo _method, SourceMarker srcMrk){ 50 super( _method, srcMrk); 51 } 52 53 public MethodWrapperDeclaration(String _name, String _declType){ 55 super(_name, _declType); 56 } 57 58 public boolean isCalled(){ 59 return called; 60 } 61 62 public void setCalled(){ 63 called = true; 64 } 65 66 71 public boolean equals(Object obj ){ 72 return this.getMethodKey().equals( ((MethodWrapper)obj).getMethodKey() ); 73 } 74 75 78 public HashSet getInvokedMethods() { 79 return invokedMethods; 80 } 81 82 public Element toDom(Document document){ 83 Element ret=document.createElement("MethodWrapperDeclaration"); 84 ret.setAttribute("id", String.valueOf( this.hashCode() )); 85 ret.setAttribute("called", String.valueOf(this.isCalled())); 86 ret.setAttribute("key", printMethodName()); 87 ret.setAttribute("source-url", getSrcURL()); 88 ret.setAttribute("line", String.valueOf(getSrcLine())); 89 ret.setAttribute("Ma", String.valueOf(afferentMethodCoupling)); 90 ret.setAttribute("Me", String.valueOf(this.invokedMethods.size())); 91 100 return ret; 101 } 102 } 103 | Popular Tags |