1 26 package org.hammurapi.inspectors.metrics; 27 28 29 import java.util.HashSet ; 30 import java.util.Set ; 31 32 import org.w3c.dom.Document ; 33 import org.w3c.dom.Element ; 34 35 import com.pavelvlasov.jsel.JselException; 36 import com.pavelvlasov.jsel.TypeBody; 37 import com.pavelvlasov.jsel.TypeDefinition; 38 import com.pavelvlasov.jsel.TypeSpecification; 39 import com.pavelvlasov.review.SourceMarker; 40 41 55 public class CouplingMetricOfClass extends CouplingMetric{ 56 public SourceMarker srcMrk = null; 57 public String name = ""; 58 public Set listAfferentTypes = new HashSet (); 59 public Set listEfferentTypes = new HashSet (); 60 61 public CouplingMetricOfClass( TypeDefinition c){ 62 super(); 63 name = c.getFcn(); 64 65 srcMrk = (SourceMarker)c; 66 } 67 68 public CouplingMetricOfClass( TypeBody c){ 69 super(); 70 name = c.getFcn(); 71 72 srcMrk = (SourceMarker)c; 73 } 74 public CouplingMetricOfClass( TypeSpecification c)throws JselException{ 75 super(); 76 name = c.getName(); 77 srcMrk = (SourceMarker)c; 78 } 79 80 public String toString(){ 81 return this.name + " CaV: " + afferentVariableCounter + " CeV: " + efferentVariableCounter; 82 } 83 117 118 public Element toDom(Document document){ 119 120 Element ret=document.createElement("CouplingMetricOfClass"); 121 ret.setAttribute("type", name ); 122 ret.setAttribute("sourceMarker", srcMrk.getSourceURL() ); 123 ret.setAttribute("sourceMarkerLine", String.valueOf( srcMrk.getLine() ) ); 124 ret.setAttribute("sourceMarkerColumn", String.valueOf( srcMrk.getColumn()) ); 125 super.toDom(document, ret); 129 130 131 Element lat=document.createElement("ListAfferentTypes"); 132 ret.appendChild( lat ); 133 134 return ret; 135 } 136 137 } 138 | Popular Tags |