ataspectj.instrumentation
Class IndexRepository

java.lang.Object
  extended by ataspectj.AtAspectjComponent
      extended by ataspectj.instrumentation.IndexRepository
All Implemented Interfaces:
java.lang.Comparable<IndexRepository>

public class IndexRepository
extends AtAspectjComponent
implements java.lang.Comparable<IndexRepository>

Class used to store information about the variables used into the annotated blocks.

Author:
Marco Poggi

Field Summary
protected  org.apache.bcel.generic.ConstantPoolGen _constantPoolGen
          It holds the constant pool gen.
protected  boolean _isPrimitive
          Boolean flags, true if the local variable haa primitive type.
protected  int _newIndex
          It holds the index of the local variable into the new method.
protected  org.apache.bcel.generic.InstructionList _objectRefToPrimitive
          It holds the instructions to restore the value of the primitive type from the wrapper object.
protected  int _objNewMethodIndex
          It holds the index into the new method for the new wrapper object
protected  int _objRefIndex
          It holds the index of the new wrapper object created into the original method.
 int _oldIndex
          It holds the index of the local variable into the original method.
protected  org.apache.bcel.generic.InstructionList _primitiveToObjectRef
          It holds the instructions to wrap the primitive variable into a wrapper object of @aspectj
protected  org.apache.bcel.generic.Type _type
          It holds the type of the local variable
protected  java.lang.String _typeSign
          It holds the type signature of the local variable.
protected  java.lang.String _vName
          It holds the name of the local variable
protected  org.apache.bcel.generic.InstructionList _wrapNew
          It holds the instructions to create the new wrapper object of @aspectj
 
Fields inherited from class ataspectj.AtAspectjComponent
barrier, CODEPRINT, DEBUG, VERBOSE
 
Constructor Summary
IndexRepository(org.apache.bcel.generic.ConstantPoolGen cp, int oi, java.lang.String tSign, java.lang.String vname)
          The constructor of the class.
 
Method Summary
 int compareTo(IndexRepository o)
          Compare two IndexRepository
 org.apache.bcel.generic.Instruction getLoadInstruction(org.apache.bcel.generic.InstructionFactory ifact)
          It creates a load instruction for the variable.
 int getNewIndex()
          The getter methods for the field _newIndex.
 org.apache.bcel.generic.InstructionList getObjectRefToPrimitiveInstructionList()
          The getter methods for the _objRefToPrimitive field.
 int getOldIndex()
          The getter methods for the field _oldIndex.
 org.apache.bcel.generic.InstructionList getPrimitiveToObjectRefInstructionList()
          The getter methods for the _pimitiveToObjRef field
 org.apache.bcel.generic.Type getType()
          The getter methods for the field _type.
 java.lang.String getTypeSignature()
          The getter methods for the field _typeSign.
 int getTypeSize()
          It gets the number of byte needed for the type.
 org.apache.bcel.generic.InstructionList getWrapNew()
          The getter methods for the field _wrapNew.
 org.apache.bcel.generic.Instruction getWrapperLoadInstruction(org.apache.bcel.generic.InstructionFactory ifact)
          It creates a load instruction for wrapper object of the variable.
 int getWrapperObjectNewMethodIndex()
          The getter methods for the field _objNewMethodIndex.
 org.apache.bcel.generic.Type getWrapType()
          Returns the wrapper type.
 boolean isPrimitive()
          It checks if the IndexRepository handles a primitive type local variable.
 void setIndexWrapperForNewMwthod(int i)
          The setter method for the field _objNewMethodIndex
 void setNewIndex(int ni)
          The getter methods for the field _newIndex.
 void setWrapperInstructionList(int objRefIndex)
          It creates the instruction list to wrapper the primitive type
 java.lang.String toString()
          It returns a simple resume of the object.
 
Methods inherited from class ataspectj.AtAspectjComponent
done
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_oldIndex

public int _oldIndex
It holds the index of the local variable into the original method.


_newIndex

protected int _newIndex
It holds the index of the local variable into the new method.


_typeSign

protected java.lang.String _typeSign
It holds the type signature of the local variable.


_vName

protected java.lang.String _vName
It holds the name of the local variable


_type

protected org.apache.bcel.generic.Type _type
It holds the type of the local variable


_isPrimitive

protected boolean _isPrimitive
Boolean flags, true if the local variable haa primitive type.


_constantPoolGen

protected org.apache.bcel.generic.ConstantPoolGen _constantPoolGen
It holds the constant pool gen.


_wrapNew

protected org.apache.bcel.generic.InstructionList _wrapNew
It holds the instructions to create the new wrapper object of @aspectj


_primitiveToObjectRef

protected org.apache.bcel.generic.InstructionList _primitiveToObjectRef
It holds the instructions to wrap the primitive variable into a wrapper object of @aspectj


_objectRefToPrimitive

protected org.apache.bcel.generic.InstructionList _objectRefToPrimitive
It holds the instructions to restore the value of the primitive type from the wrapper object.


_objRefIndex

protected int _objRefIndex
It holds the index of the new wrapper object created into the original method.


_objNewMethodIndex

protected int _objNewMethodIndex
It holds the index into the new method for the new wrapper object

Constructor Detail

IndexRepository

public IndexRepository(org.apache.bcel.generic.ConstantPoolGen cp,
                       int oi,
                       java.lang.String tSign,
                       java.lang.String vname)
The constructor of the class.

Parameters:
cp - The ConstantPoolGen
oi - the old index
tSign - the type signature
vname - the variable's name
Method Detail

setIndexWrapperForNewMwthod

public void setIndexWrapperForNewMwthod(int i)
The setter method for the field _objNewMethodIndex

Parameters:
i - the new value.

setWrapperInstructionList

public void setWrapperInstructionList(int objRefIndex)
It creates the instruction list to wrapper the primitive type

Parameters:
objRefIndex - the index to use for the new wrapper object

isPrimitive

public boolean isPrimitive()
It checks if the IndexRepository handles a primitive type local variable.

Returns:
true if handles a primitive type.

getPrimitiveToObjectRefInstructionList

public org.apache.bcel.generic.InstructionList getPrimitiveToObjectRefInstructionList()
The getter methods for the _pimitiveToObjRef field

Returns:
The InstructionList retrieved

getObjectRefToPrimitiveInstructionList

public org.apache.bcel.generic.InstructionList getObjectRefToPrimitiveInstructionList()
The getter methods for the _objRefToPrimitive field.

Returns:
The InstructionList retrieved.

getLoadInstruction

public org.apache.bcel.generic.Instruction getLoadInstruction(org.apache.bcel.generic.InstructionFactory ifact)
It creates a load instruction for the variable.

Parameters:
ifact - The instruction factory to use.
Returns:
The instruction created.

getWrapperLoadInstruction

public org.apache.bcel.generic.Instruction getWrapperLoadInstruction(org.apache.bcel.generic.InstructionFactory ifact)
It creates a load instruction for wrapper object of the variable.

Parameters:
ifact - The instruction factory to use.
Returns:
The instruction created.

getTypeSize

public int getTypeSize()
It gets the number of byte needed for the type.

Returns:
The number of bytes.

getOldIndex

public int getOldIndex()
The getter methods for the field _oldIndex.

Returns:
the value of the field.

getNewIndex

public int getNewIndex()
The getter methods for the field _newIndex.

Returns:
the value of the field.

getWrapperObjectNewMethodIndex

public int getWrapperObjectNewMethodIndex()
The getter methods for the field _objNewMethodIndex.

Returns:
the value of the field.

getWrapNew

public org.apache.bcel.generic.InstructionList getWrapNew()
The getter methods for the field _wrapNew.

Returns:
the value of the field.

getTypeSignature

public java.lang.String getTypeSignature()
The getter methods for the field _typeSign.

Returns:
the value of the field.

getType

public org.apache.bcel.generic.Type getType()
The getter methods for the field _type.

Returns:
the value of the field.

getWrapType

public org.apache.bcel.generic.Type getWrapType()
Returns the wrapper type.

Returns:
the wrapper type if the type is primitive, null otherwise.

setNewIndex

public void setNewIndex(int ni)
The getter methods for the field _newIndex.

Parameters:
ni - the new index

compareTo

public int compareTo(IndexRepository o)
Compare two IndexRepository

Specified by:
compareTo in interface java.lang.Comparable<IndexRepository>

toString

public java.lang.String toString()
It returns a simple resume of the object.

Overrides:
toString in class java.lang.Object