View Javadoc
1 /* MethodAction.java */ 2 package org.quilt.cover.stmt; 3 4 import org.apache.bcel.generic.*; 5 6 /*** 7 * <p>Process a MethodGen method before and after graph creation and 8 * manipulation. A QuiltClassLoader can have any number of such 9 * pre/post-processors. The preprocessors will be applied in order 10 * before graph generation and then the postprocessors will be 11 * applied in reverse order after graph manipulation is complete.</p> 12 * 13 * <p>If any fatal errors occur, transformers must issue a warning 14 * message on System.err and either undo any changes or set method 15 * to null.</p> 16 * 17 * @author <a href="mailto:jddixon@users.sourceforge.net">Jim Dixon</a> 18 */ 19 public class MethodAction implements org.quilt.cl.MethodXformer { 20 21 /*** Coverage registry. */ 22 private static StmtRegistry stmtReg; 23 24 /*** Name of processor for use in reports. */ 25 private static String name_ = null; 26 27 private ClassGen clazz_ = null; 28 private MethodGen method_ = null; 29 private InstructionList ilist_ = null; 30 31 public MethodAction () { 32 } 33 public MethodAction(StmtRegistry reg) { 34 stmtReg = reg; 35 setName(this.getClass().getName()); 36 } 37 38 private void dumpIList() { 39 ilist_ = method_.getInstructionList(); 40 if (ilist_ != null) { 41 int i = 0; 42 for (InstructionHandle ih = ilist_.getStart(); ih != null; 43 ih = ih.getNext() ) { 44 System.out.println(" " + (i++) + " " + ih.getInstruction()); 45 } 46 } 47 } 48 /*** 49 * Apply processing to method before graph is generated. 50 */ 51 public void preGraph( ClassGen clazz, MethodGen method) { 52 clazz_ = clazz; 53 method_ = method; 54 } 55 /*** 56 * Process method after graph generation and manipulation is 57 * complete. 58 */ 59 public void postGraph( ClassGen clazz, MethodGen method) { 60 clazz_ = clazz; 61 method_ = method; 62 } 63 64 // XFORMER INTERFACE //////////////////////////////////////////// 65 /*** Get the report name for method processor. */ 66 public String getName () { 67 return name_; 68 } 69 /*** Assign a name to the method processor. */ 70 public void setName (String name) { 71 name_ = name; 72 } 73 }

This page was automatically generated by Maven