net.sf.rej.java
Class Code

java.lang.Object
  extended by net.sf.rej.java.Code

public class Code
extends java.lang.Object

Code class models a block of code.

Author:
Sami Koivu

Constructor Summary
Code(ByteParser parser, ConstantPool pool)
           
Code(ConstantPool pool)
           
 
Method Summary
 void add(int index, Instruction instruction)
           
 void add(int index, java.util.List<Instruction> instructions)
           
 void addInstructionAtPC(int pc, Instruction instruction)
           
 void appendInstruction(Instruction instruction)
           
 DecompilationContext createDecompilationContext()
           
 byte[] getData()
           
 java.util.List<Instruction> getInstructions()
           
 int getMaxPC()
           
 int getPosition(Instruction instruction)
           
 void insertLabels(java.util.List<Label> labels)
          Inserts Labels into correct positions based on the pc information of the label.
 void moveDown(Instruction instruction)
           
 void moveUp(Instruction instruction)
           
 void printCode(java.io.PrintStream out, LineNumberTableAttribute lnAttr, LocalVariableTableAttribute lvAttr)
          Debug type dump of instructions to System.out
 void remove(Instruction instruction)
           
 void setExceptions(Exceptions exceptions)
           
 void setLineNumberTable(LineNumberTableAttribute lineNumbers)
           
 void setLocalVariableTable(LocalVariableTableAttribute lvta)
           
 void updateLabelPositions()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Code

public Code(ByteParser parser,
            ConstantPool pool)

Code

public Code(ConstantPool pool)
Method Detail

insertLabels

public void insertLabels(java.util.List<Label> labels)
Inserts Labels into correct positions based on the pc information of the label.

Parameters:
labels - List A list object containing labels

printCode

public void printCode(java.io.PrintStream out,
                      LineNumberTableAttribute lnAttr,
                      LocalVariableTableAttribute lvAttr)
Debug type dump of instructions to System.out

Parameters:
out - the stream in which to dump the code.
lnAttr - LineNumberTableAttribute
lvAttr - LocalVariableTableAttribute

getData

public byte[] getData()

getInstructions

public java.util.List<Instruction> getInstructions()

createDecompilationContext

public DecompilationContext createDecompilationContext()

addInstructionAtPC

public void addInstructionAtPC(int pc,
                               Instruction instruction)

appendInstruction

public void appendInstruction(Instruction instruction)

add

public void add(int index,
                Instruction instruction)

add

public void add(int index,
                java.util.List<Instruction> instructions)

getPosition

public int getPosition(Instruction instruction)

remove

public void remove(Instruction instruction)

updateLabelPositions

public void updateLabelPositions()

getMaxPC

public int getMaxPC()

moveUp

public void moveUp(Instruction instruction)

moveDown

public void moveDown(Instruction instruction)

setLineNumberTable

public void setLineNumberTable(LineNumberTableAttribute lineNumbers)

setLocalVariableTable

public void setLocalVariableTable(LocalVariableTableAttribute lvta)

setExceptions

public void setExceptions(Exceptions exceptions)