1 26 27 package net.sourceforge.groboutils.codecoverage.v2.module; 28 29 30 import net.sourceforge.groboutils.codecoverage.v2.IAnalysisMetaData; 31 import net.sourceforge.groboutils.codecoverage.v2.IAnalysisModule; 32 import net.sourceforge.groboutils.codecoverage.v2.IMethodCode; 33 34 35 44 public class BytecodeCountMeasure implements IAnalysisModule 45 { 46 49 public String getMeasureName() 50 { 51 return "BytecodeCount"; 52 } 53 54 57 public String getMeasureUnit() 58 { 59 return "instructions"; 60 } 61 62 63 67 public String getMimeEncoding() 68 { 69 return "text/plain"; 70 } 71 72 73 76 public void analyze( IMethodCode method ) 77 { 78 int instructionCount = method.getInstructionCount(); 79 80 for (int i = 0; i < instructionCount; ++i) 81 { 82 IAnalysisMetaData amd = createAnalysisMetaData( i ); 83 method.markInstruction( i, amd ); 84 } 85 } 86 87 88 private IAnalysisMetaData createAnalysisMetaData( int bytecodeIndex ) 89 { 90 return new DefaultAnalysisMetaData( 91 "Instruction "+bytecodeIndex, 92 "Didn't cover instruction "+bytecodeIndex, 93 (byte)0 ); 94 } 95 } 96 97 | Popular Tags |