FileDocCategorySizeDatePackage
DCONST.javaAPI DocJava SE 5 API4312Fri Aug 26 14:55:18 BST 2005com.sun.org.apache.bcel.internal.generic

DCONST

public class DCONST extends Instruction implements TypedInstruction, ConstantPushInstruction
DCONST - Push 0.0 or 1.0, other values cause an exception
Stack: ... -> ..., 
version
$Id: DCONST.java,v 1.1.1.1 2001/10/29 20:00:09 jvanzyl Exp $
author
M. Dahm

(Omit source code)

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

public DCONST(double f)

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

    if(f == 0.0)
      opcode = com.sun.org.apache.bcel.internal.Constants.DCONST_0;
    else if(f == 1.0)
      opcode = com.sun.org.apache.bcel.internal.Constants.DCONST_1;
    else
      throw new ClassGenException("DCONST can be used only for 0.0 and 1.0: " + f);

    value = f;
  
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.visitDCONST(this);
  
public com.sun.org.apache.bcel.internal.generic.TypegetType(com.sun.org.apache.bcel.internal.generic.ConstantPoolGen cp)

return
Type.DOUBLE

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

 return new Double(value);