FileDocCategorySizeDatePackage
ICONST.javaAPI DocJava SE 5 API4295Fri Aug 26 14:55:20 BST 2005com.sun.org.apache.bcel.internal.generic

ICONST

public class ICONST extends Instruction implements TypedInstruction, ConstantPushInstruction
ICONST - Push value between -1, ..., 5, other values cause an exception
Stack: ... -> ..., 
version
$Id: ICONST.java,v 1.1.1.1 2001/10/29 20:00:14 jvanzyl Exp $
author
M. Dahm

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

public ICONST(int i)

    super(com.sun.org.apache.bcel.internal.Constants.ICONST_0, (short)1);

    if((i >= -1) && (i <= 5))
      opcode = (short)(com.sun.org.apache.bcel.internal.Constants.ICONST_0 + i); // Even works for i == -1
    else
      throw new ClassGenException("ICONST can be used only for value between -1 and 5: " +
				  i);
    value = i;
  
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.visitPushInstruction(this);
    v.visitStackProducer(this);
    v.visitTypedInstruction(this);
    v.visitConstantPushInstruction(this);
    v.visitICONST(this);
  
public com.sun.org.apache.bcel.internal.generic.TypegetType(com.sun.org.apache.bcel.internal.generic.ConstantPoolGen cp)

return
Type.INT

    return Type.INT;
  
public java.lang.NumbergetValue()

 return new Integer(value);