FileDocCategorySizeDatePackage
ICONST.javaAPI DocJava SE 6 API4294Tue Jun 10 00:22:20 BST 2008com.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.2.1 2005/07/31 23:45:56 jeffsuttor Exp $
author
M. Dahm

(Omit source code)

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);