jef.dna.instructions.impl
Class TableSwitch

java.lang.Object
  extended by jef.dna.instructions.impl.InstructionAncestor
      extended by jef.dna.instructions.impl.TableSwitch
All Implemented Interfaces:
java.lang.Cloneable, Instruction, BytesCountable

public class TableSwitch
extends InstructionAncestor

This class maps the TABLESWITVH bytecode instruction which accesses jump table by index and jump. See the official javadoc documentation for further details.

Author:
ggiovanzana

Field Summary
 
Fields inherited from class jef.dna.instructions.impl.InstructionAncestor
logger, opCode, operands, operandsCount
 
Constructor Summary
TableSwitch()
          Creates a new instance of TableSwitch
 
Method Summary
 void setOperandsCountPosticipated(int[] bytecode, int startFrom)
          This method should be implemented by those classes wrapping JVM instructions whose number of operands is variable.
 int updateRefs(int offset)
          This method must implement the logic necessary to update all the references to constant pool table's entries contained within the bytecode instruction.
 
Methods inherited from class jef.dna.instructions.impl.InstructionAncestor
clone, fromArray, getBytesCount, getOpCode, getOperands, getOperandsCount, setOpCode, setOperands, toArray
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TableSwitch

public TableSwitch()
Creates a new instance of TableSwitch

Method Detail

setOperandsCountPosticipated

public void setOperandsCountPosticipated(int[] bytecode,
                                         int startFrom)
This method should be implemented by those classes wrapping JVM instructions whose number of operands is variable. This method is called by the fromArray method defined in the InstructionAncestor class. InstructionAncestor already contains an empty implementation of this method, useful for those classes exposing a prefixed number of operands. In such a case there is no need to override the setOperandsCountPosticipated method,

Specified by:
setOperandsCountPosticipated in interface Instruction
Overrides:
setOperandsCountPosticipated in class InstructionAncestor
Parameters:
bytecode - The method's bytecode
startFrom - The index of the current instruction's mnemonic (opcode)

updateRefs

public int updateRefs(int offset)
This method must implement the logic necessary to update all the references to constant pool table's entries contained within the bytecode instruction.

Specified by:
updateRefs in interface Instruction
Overrides:
updateRefs in class InstructionAncestor
Parameters:
offset - The offset used for updating expressed as number of cpt's entries to be skipped
Returns:
int The number of processed words within the current bytecode instruction