/** * Initialize from another object. */ public ConstantDouble(ConstantDouble c) { this(c.getBytes()); }
/** * Initialize from another object. */ public ConstantDouble(ConstantDouble c) { this(c.getBytes()); }
/** * Look for ConstantDouble in ConstantPool. * * @param n Double number to look for * @return index on success, -1 otherwise */ public int lookupDouble(double n) { long bits = Double.doubleToLongBits(n); for(int i=1; i < index; i++) { if(constants[i] instanceof ConstantDouble) { ConstantDouble c = (ConstantDouble)constants[i]; if(Double.doubleToLongBits(c.getBytes()) == bits) return i; } } return -1; }
/** * Look for ConstantDouble in ConstantPool. * * @param n Double number to look for * @return index on success, -1 otherwise */ public int lookupDouble(double n) { long bits = Double.doubleToLongBits(n); for(int i=1; i < index; i++) { if(constants[i] instanceof ConstantDouble) { ConstantDouble c = (ConstantDouble)constants[i]; if(Double.doubleToLongBits(c.getBytes()) == bits) return i; } } return -1; }
public Number getValue(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); } }
public Number getValue(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); } }
/** * @return String representation of constant value. */ public final String toString() { Constant c = constant_pool.getConstant(constantvalue_index); String buf; int i; // Print constant to string depending on its type switch(c.getTag()) { case Constants.CONSTANT_Long: buf = "" + ((ConstantLong)c).getBytes(); break; case Constants.CONSTANT_Float: buf = "" + ((ConstantFloat)c).getBytes(); break; case Constants.CONSTANT_Double: buf = "" + ((ConstantDouble)c).getBytes(); break; case Constants.CONSTANT_Integer: buf = "" + ((ConstantInteger)c).getBytes(); break; case Constants.CONSTANT_String: i = ((ConstantString)c).getStringIndex(); c = constant_pool.getConstant(i, Constants.CONSTANT_Utf8); buf = "\"" + Utility.convertString(((ConstantUtf8)c).getBytes()) + "\""; break; default: throw new IllegalStateException("Type of ConstValue invalid: " + c); } return buf; }
/** * @return String representation of constant value. */ public final String toString() { Constant c = constant_pool.getConstant(constantvalue_index); String buf; int i; // Print constant to string depending on its type switch(c.getTag()) { case Constants.CONSTANT_Long: buf = "" + ((ConstantLong)c).getBytes(); break; case Constants.CONSTANT_Float: buf = "" + ((ConstantFloat)c).getBytes(); break; case Constants.CONSTANT_Double: buf = "" + ((ConstantDouble)c).getBytes(); break; case Constants.CONSTANT_Integer: buf = "" + ((ConstantInteger)c).getBytes(); break; case Constants.CONSTANT_String: i = ((ConstantString)c).getStringIndex(); c = constant_pool.getConstant(i, Constants.CONSTANT_Utf8); buf = "\"" + Utility.convertString(((ConstantUtf8)c).getBytes()) + "\""; break; default: throw new IllegalStateException("Type of ConstValue invalid: " + c); } return buf; }
case Constants.CONSTANT_Double: str = "" + ((ConstantDouble)c).getBytes(); break; case Constants.CONSTANT_Float: str = "" + ((ConstantFloat)c).getBytes(); break; case Constants.CONSTANT_Long: str = "" + ((ConstantLong)c).getBytes(); break;
case Constants.CONSTANT_Double: str = "" + ((ConstantDouble)c).getBytes(); break; case Constants.CONSTANT_Float: str = "" + ((ConstantFloat)c).getBytes(); break; case Constants.CONSTANT_Long: str = "" + ((ConstantLong)c).getBytes(); break;
return addDouble(((ConstantDouble)c).getBytes());
return addDouble(((ConstantDouble)c).getBytes());