1 package com.sun.org.apache.bcel.internal.generic; 2 3 56 import java.io.*; 57 import com.sun.org.apache.bcel.internal.util.ByteSequence; 58 59 66 public class LOOKUPSWITCH extends Select { 67 71 LOOKUPSWITCH() {} 72 73 public LOOKUPSWITCH(int[] match, InstructionHandle[] targets, 74 InstructionHandle target) { 75 super(com.sun.org.apache.bcel.internal.Constants.LOOKUPSWITCH, match, targets, target); 76 77 length = (short)(9 + match_length * 8); 79 fixed_length = length; 80 } 81 82 86 public void dump(DataOutputStream out) throws IOException { 87 super.dump(out); 88 out.writeInt(match_length); 90 for(int i=0; i < match_length; i++) { 91 out.writeInt(match[i]); out.writeInt(indices[i] = getTargetOffset(targets[i])); 93 } 94 } 95 96 99 protected void initFromFile(ByteSequence bytes, boolean wide) throws IOException 100 { 101 super.initFromFile(bytes, wide); 103 match_length = bytes.readInt(); 104 fixed_length = (short)(9 + match_length * 8); 105 length = (short)(fixed_length + padding); 106 107 match = new int[match_length]; 108 indices = new int[match_length]; 109 targets = new InstructionHandle[match_length]; 110 111 for(int i=0; i < match_length; i++) { 112 match[i] = bytes.readInt(); 113 indices[i] = bytes.readInt(); 114 } 115 } 116 117 118 126 public void accept(Visitor v) { 127 v.visitVariableLengthInstruction(this); 128 v.visitStackProducer(this); 129 v.visitBranchInstruction(this); 130 v.visitSelect(this); 131 v.visitLOOKUPSWITCH(this); 132 } 133 } 134 | Popular Tags |