FileDocCategorySizeDatePackage
LDC2_W.javaAPI DocJava SE 5 API4847Fri Aug 26 14:55:22 BST 2005com.sun.org.apache.bcel.internal.generic

LDC2_W

public class LDC2_W extends CPInstruction implements TypedInstruction, PushInstruction
LDC2_W - Push long or double from constant pool
Stack: ... -> ..., item.word1, item.word2
version
$Id: LDC2_W.java,v 1.1.1.1 2001/10/29 20:00:21 jvanzyl Exp $
author
M. Dahm

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

public LDC2_W(int index)

    super(com.sun.org.apache.bcel.internal.Constants.LDC2_W, index);
  
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.visitStackProducer(this);
    v.visitPushInstruction(this);
    v.visitTypedInstruction(this);
    v.visitCPInstruction(this);
    v.visitLDC2_W(this);
  
public com.sun.org.apache.bcel.internal.generic.TypegetType(com.sun.org.apache.bcel.internal.generic.ConstantPoolGen cpg)

    switch(cpg.getConstantPool().getConstant(index).getTag()) {
    case com.sun.org.apache.bcel.internal.Constants.CONSTANT_Long:   return Type.LONG;
    case com.sun.org.apache.bcel.internal.Constants.CONSTANT_Double: return Type.DOUBLE;
    default: // Never reached
      throw new RuntimeException("Unknown constant type " + opcode);
    }
  
public java.lang.NumbergetValue(com.sun.org.apache.bcel.internal.generic.ConstantPoolGen cpg)

    com.sun.org.apache.bcel.internal.classfile.Constant c = cpg.getConstantPool().getConstant(index);

    switch(c.getTag()) {
    case com.sun.org.apache.bcel.internal.Constants.CONSTANT_Long:
	return new Long(((com.sun.org.apache.bcel.internal.classfile.ConstantLong)c).getBytes());

    case com.sun.org.apache.bcel.internal.Constants.CONSTANT_Double:
	return new Double(((com.sun.org.apache.bcel.internal.classfile.ConstantDouble)c).getBytes());

    default: // Never reached
      throw new RuntimeException("Unknown or invalid constant type at " + index);
      }