TechTrader Bytecode Toolkit

com.techtrader.modules.tools.bytecode
Class LookupSwitchInstruction

java.lang.Object
  |
  +--com.techtrader.modules.tools.bytecode.Instruction
        |
        +--com.techtrader.modules.tools.bytecode.JumpInstruction
              |
              +--com.techtrader.modules.tools.bytecode.LookupSwitchInstruction

public class LookupSwitchInstruction
extends JumpInstruction

The LOOKUPSWITCH instruction.

Author:
Abe White

Fields inherited from class com.techtrader.modules.tools.bytecode.JumpInstruction
_offset, _target
 
Fields inherited from class com.techtrader.modules.tools.bytecode.Instruction
_byteIndex, _opcode, _opcodeTypes, _owner
 
Constructor Summary
protected LookupSwitchInstruction(Code owner)
           
 
Method Summary
 void acceptVisit(BCVisitor visit)
          Accept a visit from a BCVisitor, calling the appropriate methods to notify the visitor that it has entered this entity, and to provide it with the proper callbacks for each sub-entity owned by this object.
 void addCase(int match, Instruction target)
           
 int getDefaultOffset()
          Synonymous with getOffset().
 Instruction getDefaultTarget()
          Synonymous with getTarget().
 int getLength()
          Return the length in bytes of this opcode, including all arguments.
 int[] getMatches()
           
 int[] getOffsets()
           
 int getStackChange()
          Return the number of stack positions this instruction pushes or pops during its execution.
 Instruction[] getTargets()
           
 void readData(DataInput in)
          Read the arguments for this opcode from the given stream.
 void setCases(int[] matches, Instruction[] targets)
          Set the match-jumppt pairs for this switch.
 void setCases(int[] matches, int[] offsets)
          Set the match-offset pairs for this switch.
 void setDefaultOffset(int offset)
          Synonymous with setOffset().
 void setDefaultTarget(Instruction ins)
          Synonymous with setTarget().
 void setMarkers(List inss)
          Use the byte indexes read from the .class file to calculate and set references to the target instruction(s) for this ptr.
 void writeData(DataOutput out)
          Write the arguments for this opcode to the given stream.
 
Methods inherited from class com.techtrader.modules.tools.bytecode.JumpInstruction
copy, equals, getOffset, getTarget, setOffset, setTarget
 
Methods inherited from class com.techtrader.modules.tools.bytecode.Instruction
getByteIndex, getName, getOpCode, getOwner, invalidate, setByteIndex, setOpCode
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LookupSwitchInstruction

protected LookupSwitchInstruction(Code owner)
Method Detail

getDefaultTarget

public Instruction getDefaultTarget()
Synonymous with getTarget().

setDefaultTarget

public void setDefaultTarget(Instruction ins)
Synonymous with setTarget().

getDefaultOffset

public int getDefaultOffset()
Synonymous with getOffset().

setDefaultOffset

public void setDefaultOffset(int offset)
Synonymous with setOffset().

setCases

public void setCases(int[] matches,
                     Instruction[] targets)
Set the match-jumppt pairs for this switch.

setCases

public void setCases(int[] matches,
                     int[] offsets)
Set the match-offset pairs for this switch.

getMatches

public int[] getMatches()

getTargets

public Instruction[] getTargets()

getOffsets

public int[] getOffsets()

addCase

public void addCase(int match,
                    Instruction target)

getLength

public int getLength()
Description copied from class: Instruction
Return the length in bytes of this opcode, including all arguments. This method should be overridden by opcodes that take arguments.
Overrides:
getLength in class JumpInstruction

getStackChange

public int getStackChange()
Description copied from class: Instruction
Return the number of stack positions this instruction pushes or pops during its execution.
Overrides:
getStackChange in class JumpInstruction
Tags copied from class: Instruction
Returns:
0 if the stack is not affected by this instruction, a positive number if it pushes onto the stack, and a negative number if it pops from the stack

readData

public void readData(DataInput in)
              throws IOException
Description copied from class: Instruction
Read the arguments for this opcode from the given stream. This method should be overridden by opcodes that take arguments.
Overrides:
readData in class JumpInstruction

writeData

public void writeData(DataOutput out)
               throws IOException
Description copied from class: Instruction
Write the arguments for this opcode to the given stream. This method should be overridden by opcodes that take arguments.
Overrides:
writeData in class JumpInstruction

setMarkers

public void setMarkers(List inss)
Description copied from interface: InstructionPtr
Use the byte indexes read from the .class file to calculate and set references to the target instruction(s) for this ptr. This method will be called after the byte code has been read in for the first time.
Overrides:
setMarkers in class JumpInstruction
Tags copied from interface: InstructionPtr
Parameters:
codes - the list of opcodes in the method

acceptVisit

public void acceptVisit(BCVisitor visit)
Description copied from interface: VisitAcceptor
Accept a visit from a BCVisitor, calling the appropriate methods to notify the visitor that it has entered this entity, and to provide it with the proper callbacks for each sub-entity owned by this object.
Overrides:
acceptVisit in class JumpInstruction

TechTrader Bytecode Toolkit