FileDocCategorySizeDatePackage
LDC2_W.javaAPI DocJava SE 6 API4850Tue Jun 10 00:22:22 BST 2008com.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.2.1 2005/07/31 23:44:40 jeffsuttor 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);
      }