net.sourceforge.groboutils.codecoverage.v2.compiler
Class DefaultMethodCode

java.lang.Object
  extended bynet.sourceforge.groboutils.codecoverage.v2.compiler.DefaultMethodCode
All Implemented Interfaces:
IMethodCode

public class DefaultMethodCode
extends java.lang.Object
implements IMethodCode

Implements the per-module interface to the method's code and marking the code. Controls the module's index and the current module's mark index for this method.

Since:
December 17, 2002
Version:
$Date: 2003/05/05 05:45:32 $
Author:
Matt Albrecht groboclown@users.sourceforge.net

Method Summary
 java.lang.String getClassName()
          A helper to get the class name.
 org.apache.bcel.generic.Instruction getInstructionAt(int index)
          Returns the bytecode instruction at the given index.
 int getInstructionCount()
          Returns the number of bytecode instructions in the method.
 java.lang.String getMethodName()
          A helper to get the method name.
 org.apache.bcel.classfile.Method getOriginalMethod()
          Returns the original BCEL Method object.
 void markInstruction(int index, IAnalysisMetaData meta)
          Marks an instruction for coverage analysis.
 java.lang.String toString()
          Output a friendly version of the object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getOriginalMethod

public org.apache.bcel.classfile.Method getOriginalMethod()
Returns the original BCEL Method object.

Specified by:
getOriginalMethod in interface IMethodCode
Returns:
the original BCEL Method object

getMethodName

public java.lang.String getMethodName()
A helper to get the method name.

Specified by:
getMethodName in interface IMethodCode
Returns:
the method name

getClassName

public java.lang.String getClassName()
A helper to get the class name.

Specified by:
getClassName in interface IMethodCode
Returns:
the class name

getInstructionCount

public int getInstructionCount()
Returns the number of bytecode instructions in the method.

Specified by:
getInstructionCount in interface IMethodCode
Returns:
the number of bytecode instructions

getInstructionAt

public org.apache.bcel.generic.Instruction getInstructionAt(int index)
Returns the bytecode instruction at the given index. If the index is out of range (< 0 or >= getInstructionCount()), then a IndexOutOfBoundsException is thrown.

Specified by:
getInstructionAt in interface IMethodCode
Parameters:
index - the 0-based index of the method's instruction list
Returns:
the instruction at index

markInstruction

public void markInstruction(int index,
                            IAnalysisMetaData meta)
Marks an instruction for coverage analysis. If the index is out of range (< 0 or > getInstructionCount()), then a IndexOutOfBoundsException is thrown. Marks are added before the instruction at the given index is executed. Note that to mark the end of the method, you should use index equal to getInstructionCount()

Specified by:
markInstruction in interface IMethodCode
Parameters:
index - the 0-based index of the method's instruction list
meta - meta-data the analysis module records in association with the mark. This cannot be null.

toString

public java.lang.String toString()
Output a friendly version of the object.



Copyright © 2001-2003 by The GroboUtils Project