1 package com.sun.org.apache.bcel.internal.generic; 2 3 56 57 65 public class ICONST extends Instruction 66 implements ConstantPushInstruction, TypedInstruction { 67 private int value; 68 69 73 ICONST() {} 74 75 public ICONST(int i) { 76 super(com.sun.org.apache.bcel.internal.Constants.ICONST_0, (short)1); 77 78 if((i >= -1) && (i <= 5)) 79 opcode = (short)(com.sun.org.apache.bcel.internal.Constants.ICONST_0 + i); else 81 throw new ClassGenException("ICONST can be used only for value between -1 and 5: " + 82 i); 83 value = i; 84 } 85 86 public Number getValue() { return new Integer (value); } 87 88 90 public Type getType(ConstantPoolGen cp) { 91 return Type.INT; 92 } 93 94 95 103 public void accept(Visitor v) { 104 v.visitPushInstruction(this); 105 v.visitStackProducer(this); 106 v.visitTypedInstruction(this); 107 v.visitConstantPushInstruction(this); 108 v.visitICONST(this); 109 } 110 } 111 | Popular Tags |