1 26 27 package net.sourceforge.groboutils.codecoverage.v2.report; 28 29 30 import java.io.IOException ; 31 import java.util.HashSet ; 32 import java.util.Set ; 33 34 import net.sourceforge.groboutils.codecoverage.v2.IAnalysisMetaData; 35 import net.sourceforge.groboutils.codecoverage.v2.IAnalysisModule; 36 import net.sourceforge.groboutils.codecoverage.v2.IChannelLogReader; 37 import net.sourceforge.groboutils.codecoverage.v2.IChannelLogRecord; 38 import net.sourceforge.groboutils.codecoverage.v2.IClassChannelLogReader; 39 import net.sourceforge.groboutils.codecoverage.v2.datastore.ClassRecord; 40 import net.sourceforge.groboutils.codecoverage.v2.datastore.IClassMetaDataReader; 41 import net.sourceforge.groboutils.codecoverage.v2.datastore.IMetaDataReader; 42 import net.sourceforge.groboutils.codecoverage.v2.datastore.MarkRecord; 43 44 45 54 public class AnalysisModuleData 55 { 56 private IChannelLogReader logReader; 57 private IClassMetaDataReader mdReader; 58 private IAnalysisModule am; 59 60 61 64 public AnalysisModuleData( IAnalysisModule module, 65 IMetaDataReader mdr, IChannelLogReader clr ) 66 throws IOException 67 { 68 if (module == null || mdr == null || clr == null) 69 { 70 throw new IllegalArgumentException ( "No null args." ); 71 } 72 this.mdReader = mdr.getClassReader( module ); 73 this.logReader = clr; 74 this.am = module; 75 } 76 77 78 81 public IAnalysisModule getAnalysisModule() 82 { 83 return this.am; 84 } 85 86 87 91 public String [] getClassSignatures() 92 throws IOException 93 { 94 String cs[] = this.mdReader.getClassSignatures(); 95 return cs; 96 } 97 98 99 102 public ClassRecord getClassRecord( String classSig ) 103 throws IOException 104 { 105 return this.mdReader.readClass( classSig ); 106 } 107 108 109 112 public MarkRecord[] getAllClassMarks( String classSig ) 113 throws IOException 114 { 115 return getClassRecord( classSig ).getMarksForAnalysisModule( this.am ); 116 } 117 118 119 122 public IChannelLogRecord[] getChannelLogRecords( String classSig ) 123 throws IOException 124 { 125 Set set = new HashSet (); 126 IClassChannelLogReader reader = this.logReader. 127 getReaderForClassSignature( classSig ); 128 IChannelLogRecord clr = reader.nextRecord(); 129 while (clr != null) 130 { 131 set.add( clr ); 132 clr = reader.nextRecord(); 133 } 134 135 IChannelLogRecord[] records = (IChannelLogRecord[])set.toArray( 136 new IChannelLogRecord[ set.size() ] ); 137 return records; 138 } 139 140 141 145 public ClassMarkSet createClassMarkSet( String classSig ) 146 throws IOException 147 { 148 ClassRecord cr = getClassRecord( classSig ); 149 ClassMarkSet cms = new ClassMarkSet( 150 cr.getClassName(), 151 cr.getMethods(), 152 getAllClassMarks( classSig ), 153 getChannelLogRecords( classSig ) ); 154 return cms; 155 } 156 } 157 158 | Popular Tags |