/** * @param cp Constant pool * @param value to be pushed */ public PUSH(ConstantPoolGen cp, double value) { if(value == 0.0) instruction = DCONST_0; else if(value == 1.0) instruction = DCONST_1; else // Create a Constant pool entry instruction = new LDC2_W(cp.addDouble(value)); }
public SimpleElementValueGen(final int type, final ConstantPoolGen cpGen, final double value) { super(type, cpGen); idx = getConstantPool().addDouble(value); }
/** * @param cp Constant pool * @param value to be pushed */ public PUSH(final ConstantPoolGen cp, final double value) { if (value == 0.0) { instruction = InstructionConst.DCONST_0; } else if (value == 1.0) { instruction = InstructionConst.DCONST_1; } else { instruction = new LDC2_W(cp.addDouble(value)); } }
private int addConstant() { switch(type.getType()) { case Constants.T_INT: case Constants.T_CHAR: case Constants.T_BYTE: case Constants.T_BOOLEAN: case Constants.T_SHORT: return cp.addInteger(((Integer)value).intValue()); case Constants.T_FLOAT: return cp.addFloat(((Float)value).floatValue()); case Constants.T_DOUBLE: return cp.addDouble(((Double)value).doubleValue()); case Constants.T_LONG: return cp.addLong(((Long)value).longValue()); case Constants.T_REFERENCE: return cp.addString(((String)value)); default: throw new RuntimeException("Oops: Unhandled : " + type.getType()); } }
private int addConstant() { switch (super.getType().getType()) { // sic case Const.T_INT: case Const.T_CHAR: case Const.T_BYTE: case Const.T_BOOLEAN: case Const.T_SHORT: return super.getConstantPool().addInteger(((Integer) value).intValue()); case Const.T_FLOAT: return super.getConstantPool().addFloat(((Float) value).floatValue()); case Const.T_DOUBLE: return super.getConstantPool().addDouble(((Double) value).doubleValue()); case Const.T_LONG: return super.getConstantPool().addLong(((Long) value).longValue()); case Const.T_REFERENCE: return super.getConstantPool().addString((String) value); default: throw new RuntimeException("Oops: Unhandled : " + super.getType().getType()); // sic } }
return addUtf8(((ConstantUtf8) c).getBytes()); case Const.CONSTANT_Double: return addDouble(((ConstantDouble) c).getBytes()); case Const.CONSTANT_Float: return addFloat(((ConstantFloat) c).getBytes());
return addDouble(((ConstantDouble)c).getBytes());
break; case PRIMITIVE_DOUBLE: idx = cpool.addDouble(value.getValueDouble()); break; case PRIMITIVE_BOOLEAN:
break; case Const.LDC2_W: ins = new LDC2_W(constants.addDouble(Math.PI)); break; case Const.ILOAD: