FileDocCategorySizeDatePackage
LOOKUPSWITCH.javaAPI DocJava SE 5 API5068Fri Aug 26 14:55:22 BST 2005com.sun.org.apache.bcel.internal.generic

LOOKUPSWITCH

public class LOOKUPSWITCH extends Select
LOOKUPSWITCH - Switch with unordered set of values
version
$Id: LOOKUPSWITCH.java,v 1.1.1.1 2001/10/29 20:00:22 jvanzyl Exp $
author
M. Dahm
see
SWITCH

Fields Summary
Constructors Summary
LOOKUPSWITCH()
Empty constructor needed for the Class.newInstance() statement in Instruction.readInstruction(). Not to be used otherwise.

public LOOKUPSWITCH(int[] match, InstructionHandle[] targets, InstructionHandle target)

    super(com.sun.org.apache.bcel.internal.Constants.LOOKUPSWITCH, match, targets, target);
    
    length = (short)(9 + match_length * 8); /* alignment remainder assumed
					     * 0 here, until dump time. */
    fixed_length = length;
  
Methods Summary
public voidaccept(com.sun.org.apache.bcel.internal.generic.Visitor v)
Call corresponding visitor method(s). The order is: Call visitor methods of implemented interfaces first, then call methods according to the class hierarchy in descending order, i.e., the most specific visitXXX() call comes last.

param
v Visitor object

    v.visitVariableLengthInstruction(this);
    v.visitStackProducer(this);
    v.visitBranchInstruction(this);
    v.visitSelect(this);
    v.visitLOOKUPSWITCH(this);
  
public voiddump(java.io.DataOutputStream out)
Dump instruction as byte code to stream out.

param
out Output stream

    super.dump(out);
    out.writeInt(match_length);       // npairs

    for(int i=0; i < match_length; i++) {
      out.writeInt(match[i]);         // match-offset pairs
      out.writeInt(indices[i] = getTargetOffset(targets[i]));
    }
  
protected voidinitFromFile(com.sun.org.apache.bcel.internal.util.ByteSequence bytes, boolean wide)
Read needed data (e.g. index) from file.

    super.initFromFile(bytes, wide); // reads padding

    match_length = bytes.readInt();
    fixed_length = (short)(9 + match_length * 8);
    length       = (short)(fixed_length + padding);
	  
    match   = new int[match_length];
    indices = new int[match_length];
    targets = new InstructionHandle[match_length];

    for(int i=0; i < match_length; i++) {
      match[i]   = bytes.readInt();
      indices[i] = bytes.readInt();
    }