All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class de.fub.bytecode.generic.Select

java.lang.Object
   |
   +----de.fub.bytecode.generic.Instruction
           |
           +----de.fub.bytecode.generic.BranchInstruction
                   |
                   +----de.fub.bytecode.generic.Select

public abstract class Select
extends BranchInstruction
implements VariableLengthInstruction
Select - Abstract super class for LOOKUPSWITCH and TABLESWITCH instructions.

Version:
$Id: Select.java,v 1.10 1999/08/30 13:54:10 dahm Exp $
Author:
M. Dahm
See Also:
LOOKUPSWITCH, TABLESWITCH, InstructionList

Variable Index

 o fixed_length
 o indices
 o match
 o match_length
 o padding
 o targets

Method Index

 o containsTarget(InstructionHandle)
 o dump(DataOutputStream)
Dump instruction as byte code to stream out.
 o getIndices()
 o getMatchs()
 o getTargets()
 o initFromFile(ByteSequence, boolean)
Read needed data (e.g.
 o setTarget(int, InstructionHandle)
Set branch target for `i'th case
 o toString(boolean)
 o updatePosition(int, int)
Since this is a variable length instruction, it may shift the following instructions which then need to update their position.
 o updateTarget(InstructionHandle, InstructionHandle)

Variables

 o match
 protected int match[]
 o indices
 protected int indices[]
 o targets
 protected InstructionHandle targets[]
 o fixed_length
 protected int fixed_length
 o match_length
 protected int match_length
 o padding
 protected int padding

Methods

 o updatePosition
 protected int updatePosition(int offset,
                              int max_offset)
Since this is a variable length instruction, it may shift the following instructions which then need to update their position. Called by InstructionList.setPositions when setting the position for every instruction. In the presence of variable length instructions `setPositions' performs multiple passes over the instruction list to calculate the correct (byte) positions and offsets by calling this function.

Parameters:
offset - additional offset caused by preceding (variable length) instructions
max_offset - the maximum offset that may be caused by these instructions
Returns:
additional offset caused by possible change of this instruction's length
Overrides:
updatePosition in class BranchInstruction
 o dump
 public void dump(DataOutputStream out) throws IOException
Dump instruction as byte code to stream out.

Parameters:
out - Output stream
Overrides:
dump in class BranchInstruction
 o initFromFile
 protected void initFromFile(ByteSequence bytes,
                             boolean wide) throws IOException
Read needed data (e.g. index) from file.

Overrides:
initFromFile in class BranchInstruction
 o toString
 public String toString(boolean verbose)
Returns:
mnemonic for instruction
Overrides:
toString in class BranchInstruction
 o setTarget
 public void setTarget(int i,
                       InstructionHandle target)
Set branch target for `i'th case

 o updateTarget
 public void updateTarget(InstructionHandle old_ih,
                          InstructionHandle new_ih)
Parameters:
old_ih - old target
new_ih - new target
Overrides:
updateTarget in class BranchInstruction
 o containsTarget
 public boolean containsTarget(InstructionHandle ih)
Returns:
true, if ih is target of this instruction
Overrides:
containsTarget in class BranchInstruction
 o getMatchs
 public int[] getMatchs()
Returns:
array of match indices
 o getIndices
 public int[] getIndices()
Returns:
array of match target offsets
 o getTargets
 public InstructionHandle[] getTargets()
Returns:
array of match targets

All Packages  Class Hierarchy  This Package  Previous  Next  Index