de.uka.ipd.sdq.ByCounter.parsing
Class InstructionBlockDescriptor

java.lang.Object
  extended by de.uka.ipd.sdq.ByCounter.parsing.InstructionBlockDescriptor
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
RangeBlockDescriptor

public class InstructionBlockDescriptor
extends java.lang.Object
implements java.io.Serializable

Descriptor for a instruction blocks in Java bytecode.

Author:
Martin Krogmann
See Also:
Serialized Form

Constructor Summary
InstructionBlockDescriptor()
           
 
Method Summary
 void add(InstructionBlockDescriptor instructionBlockDescriptor)
          Adds instruction counts of the given block to this block.
static void addInstruction(InstructionBlockDescriptor currentIBDesc, org.objectweb.asm.tree.AbstractInsnNode insn)
          Adds an instruction to the InstructionBlockDescriptor.
 int getBlockIndex()
          The block index is an identifier for the local variable in bytecode that is associated to this instruction block.
 java.util.Map<java.lang.String,java.lang.Integer> getMethodCallCounts()
          Method call counts is a map containing all occurring method calls as keys and the number of occurrences as values.
 int[] getOpcodeCounts()
          Opcode counts is an array where at the index of each opcode the number of occurrences of that opcode is the value.
 boolean isEmpty()
           
 void setBlockIndex(int blockIndex)
          Theblock index is an identifier for the local variable in bytecode that is associated to this instruction block.
static InstructionBlockDescriptor subtract(InstructionBlockDescriptor bb1, InstructionBlockDescriptor bb2)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

InstructionBlockDescriptor

public InstructionBlockDescriptor()
Method Detail

setBlockIndex

public void setBlockIndex(int blockIndex)
Theblock index is an identifier for the local variable in bytecode that is associated to this instruction block.

Parameters:
blockIndex - the blockIndex to set

getBlockIndex

public int getBlockIndex()
The block index is an identifier for the local variable in bytecode that is associated to this instruction block.

Returns:
the basicIndex

getOpcodeCounts

public int[] getOpcodeCounts()
Opcode counts is an array where at the index of each opcode the number of occurrences of that opcode is the value.

Returns:
the opcodeCounts

getMethodCallCounts

public java.util.Map<java.lang.String,java.lang.Integer> getMethodCallCounts()
Method call counts is a map containing all occurring method calls as keys and the number of occurrences as values.

Returns:
the methodCallCounts

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

addInstruction

public static void addInstruction(InstructionBlockDescriptor currentIBDesc,
                                  org.objectweb.asm.tree.AbstractInsnNode insn)
Adds an instruction to the InstructionBlockDescriptor.

Parameters:
currentIBDesc - The InstructionBlockDescriptor to add to.
insn - The instruction to add.

add

public void add(InstructionBlockDescriptor instructionBlockDescriptor)
Adds instruction counts of the given block to this block. Ignores block index.

Parameters:
instructionBlockDescriptor -

subtract

public static InstructionBlockDescriptor subtract(InstructionBlockDescriptor bb1,
                                                  InstructionBlockDescriptor bb2)
Parameters:
bb1 - An InstructionBlockDescriptor.
bb2 - An InstructionBlockDescriptor.
Returns:
A new InstructionBlockDescriptor containing the count difference of bb1 and bb2, i.e. bb1-bb2.

isEmpty

public boolean isEmpty()
Returns:
True if neither opcode offsets nor methodCallCount offsets exist. False otherwise.