edu.rice.cs.cunit.classFile.attributes
Class InstrumentationAttributeInfo

java.lang.Object
  extended by edu.rice.cs.cunit.classFile.attributes.AAttributeInfo
      extended by edu.rice.cs.cunit.classFile.attributes.InstrumentationAttributeInfo
All Implemented Interfaces:
java.lang.Cloneable

public class InstrumentationAttributeInfo
extends AAttributeInfo

Represents the Instrumentation attribute in a class file.

Author:
Mathias Ricken

Field Summary
static java.lang.String NAME
          Name of this attribute.
 
Fields inherited from class edu.rice.cs.cunit.classFile.attributes.AAttributeInfo
_constantPool, _data, _name
 
Constructor Summary
InstrumentationAttributeInfo(AUTFPoolInfo name, byte[] data, ConstantPool cp)
          Constructor.
 
Method Summary
static void addInstrumentationAttributeInfo(ClassFile cf, java.util.Collection<java.lang.String> itors)
          Add the Instrumentation attribute with the given list of instrumentors to the class file.
static void addInstrumentationAttributeInfo(ClassFile cf, java.util.List<IInstrumentationStrategy> itors)
          Add the Instrumentation attribute with the given list of instrumentors to the class file.
static void addInstrumentationAttributeInfo(ClassFile cf, java.lang.String s)
          Add the Instrumentation attribute with the given instrumentor class name string to the class file.
 void adjustPC(int startPC, int deltaPC)
          Adjust program counter values contained in this attribute, starting at startPC, by adding deltaPC to them.
 java.lang.Object clone()
          Creates and returns a copy of this object.
<R,D> R
execute(IAttributeVisitor<R,D> visitor, D param)
          Execute a visitor on this attribute.
static java.lang.String getAttributeName()
          Returns the name of the attribute as it appears in the class file.
 java.lang.String[] getInstrumentatorClassNames()
          Return an array of instrumentator class names.
 java.lang.String getInstrumentatorClassNameString()
          Return the instrumentator class names as string.
 void setInstrumentatorClassNames(java.lang.String[] classNames)
          Set the source file name information.
 java.lang.String toString()
          Return a human-readable version of this attribute.
 void translatePC(int index, int deltaIndex, LineNumberTable oldLnt, LineNumberTable newLnt)
          Translate the program counter values contained in this attribute from an old line number table to a new one.
 
Methods inherited from class edu.rice.cs.cunit.classFile.attributes.AAttributeInfo
equals, getData, getName, hashCode, read, setData, setName, write
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

NAME

public static final java.lang.String NAME
Name of this attribute.

See Also:
Constant Field Values
Constructor Detail

InstrumentationAttributeInfo

public InstrumentationAttributeInfo(AUTFPoolInfo name,
                                    byte[] data,
                                    ConstantPool cp)
                             throws java.lang.ClassFormatError
Constructor.

Parameters:
name - attribute name
data - attribute data
cp - constant pool
Throws:
java.lang.ClassFormatError
Method Detail

getInstrumentatorClassNames

public java.lang.String[] getInstrumentatorClassNames()
                                               throws java.lang.ClassFormatError
Return an array of instrumentator class names.

Returns:
array of instrumentator class names
Throws:
java.lang.ClassFormatError

getInstrumentatorClassNameString

public java.lang.String getInstrumentatorClassNameString()
                                                  throws java.lang.ClassFormatError
Return the instrumentator class names as string.

Returns:
string with instrumentator class names
Throws:
java.lang.ClassFormatError

setInstrumentatorClassNames

public void setInstrumentatorClassNames(java.lang.String[] classNames)
Set the source file name information.

Parameters:
classNames - constant pool

execute

public <R,D> R execute(IAttributeVisitor<R,D> visitor,
                       D param)
Execute a visitor on this attribute.

Specified by:
execute in class AAttributeInfo
Parameters:
visitor - visitor
param - visitor-specific parameter
Returns:
visitor-specific return value

adjustPC

public void adjustPC(int startPC,
                     int deltaPC)
Adjust program counter values contained in this attribute, starting at startPC, by adding deltaPC to them.

Specified by:
adjustPC in class AAttributeInfo
Parameters:
startPC - program counter to start at
deltaPC - change in program counter values

translatePC

public void translatePC(int index,
                        int deltaIndex,
                        LineNumberTable oldLnt,
                        LineNumberTable newLnt)
Translate the program counter values contained in this attribute from an old line number table to a new one.

Specified by:
translatePC in class AAttributeInfo
Parameters:
index - critical point (insertion or deletion point)
deltaIndex - delta value to add to all old line numbers greater than the critical point
oldLnt - old line number table
newLnt - new line number table

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Creates and returns a copy of this object.

Overrides:
clone in class AAttributeInfo
Throws:
java.lang.CloneNotSupportedException

toString

public java.lang.String toString()
Return a human-readable version of this attribute.

Overrides:
toString in class AAttributeInfo
Returns:
string

addInstrumentationAttributeInfo

public static void addInstrumentationAttributeInfo(ClassFile cf,
                                                   java.lang.String s)
Add the Instrumentation attribute with the given instrumentor class name string to the class file.

Parameters:
cf - class file
s - names of instrumentor classes, separated by ';'

addInstrumentationAttributeInfo

public static void addInstrumentationAttributeInfo(ClassFile cf,
                                                   java.util.List<IInstrumentationStrategy> itors)
Add the Instrumentation attribute with the given list of instrumentors to the class file.

Parameters:
cf - class file
itors - list of instrumentors

addInstrumentationAttributeInfo

public static void addInstrumentationAttributeInfo(ClassFile cf,
                                                   java.util.Collection<java.lang.String> itors)
Add the Instrumentation attribute with the given list of instrumentors to the class file.

Parameters:
cf - class file
itors - collection of instrumentor class names

getAttributeName

public static java.lang.String getAttributeName()
Returns the name of the attribute as it appears in the class file.

Returns:
name of the attribute.