Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.chaoswg.xtc4y.classdesc.code.instructions
Class LookupSwitchInstruction  view LookupSwitchInstruction download LookupSwitchInstruction.java

java.lang.Object
  extended bycom.chaoswg.xtc4y.classdesc.code.instructions.Instruction
      extended bycom.chaoswg.xtc4y.classdesc.code.instructions.LookupSwitchInstruction

public class LookupSwitchInstruction
extends Instruction

A Lookup switch instruction is used to represent switch statements. It consists of the command, an int giving the number of entries, an int defining the default jump address and a set of entries where each entry consists of two ints, the case number and the jump address. The end of a LookupSwitch Instruction is aligned to 4 byte and therefore gaps are filled up with nop's. !The empty instructions are filled up before the default jump adress and the numberOfEntries That means: (1byte+4bytes+4bytes+(4bytes+4bytes)*+((index+length)%4))


Field Summary
private  int[] cases
           
private  Instruction defaultInstr
           
private  int defaultJumpAdress
           
private  java.io.DataInputStream dis
           
private  int gap
           
private  Instruction[] jumpInstr
           
private  int[] jumps
           
static byte LOOKUPSWITCH
          Opcode of the lookup switch instructions
private  int numberOfEntries
           
 
Fields inherited from class com.chaoswg.xtc4y.classdesc.code.instructions.Instruction
 
Constructor Summary
protected LookupSwitchInstruction(java.io.DataInputStream dis, com.chaoswg.xtc4y.classdesc.ConstantPool cp)
          Creates an LookupSwitchInstruction and initializes it from a DataInputStream
 
Method Summary
 int getNumberOfUsedBytes()
           
 void resolveIndices(com.chaoswg.xtc4y.classdesc.code.Code code)
          Resolve indices of instructions.
 void setIndex(short index)
          Set the index of this instruction, is set by the code container
 void write(java.io.DataOutputStream dos, com.chaoswg.xtc4y.classdesc.ConstantPool cp)
          Write the instruction onto the DataOutputStream, using the constant pool to register variables.
 
Methods inherited from class com.chaoswg.xtc4y.classdesc.code.instructions.Instruction
getCommand, getIndex, getOpcode, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

numberOfEntries

private int numberOfEntries

defaultJumpAdress

private int defaultJumpAdress

cases

private int[] cases

jumps

private int[] jumps

gap

private int gap

defaultInstr

private Instruction defaultInstr

jumpInstr

private Instruction[] jumpInstr

dis

private java.io.DataInputStream dis

LOOKUPSWITCH

public static final byte LOOKUPSWITCH
Opcode of the lookup switch instructions

See Also:
Constant Field Values
Constructor Detail

LookupSwitchInstruction

protected LookupSwitchInstruction(java.io.DataInputStream dis,
                                  com.chaoswg.xtc4y.classdesc.ConstantPool cp)
                           throws java.io.IOException
Creates an LookupSwitchInstruction and initializes it from a DataInputStream

Method Detail

setIndex

public void setIndex(short index)
Set the index of this instruction, is set by the code container

Overrides:
setIndex in class Instruction

resolveIndices

public void resolveIndices(com.chaoswg.xtc4y.classdesc.code.Code code)
Resolve indices of instructions. By default do nothing

Overrides:
resolveIndices in class Instruction

write

public final void write(java.io.DataOutputStream dos,
                        com.chaoswg.xtc4y.classdesc.ConstantPool cp)
                 throws java.io.IOException
Write the instruction onto the DataOutputStream, using the constant pool to register variables. .

Overrides:
write in class Instruction

getNumberOfUsedBytes

public int getNumberOfUsedBytes()
Specified by:
getNumberOfUsedBytes in class Instruction