Package org.apache.bcel.classfile

Examples of org.apache.bcel.classfile.ConstantDouble


     */
    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;
View Full Code Here


        if ((ret = lookupDouble(n)) != -1) {
            return ret; // Already in CP
        }
        adjustSize();
        ret = index;
        constants[index] = new ConstantDouble(n);
        index += 2; // Wastes one entry according to spec
        return ret;
    }
View Full Code Here

                    result.append(c.getNameAndTypeIndex());
                    result.append(";\t//  ");
                    result.append(Utility.replace(
                            constPool.constantToString(c), " ", ":"));
                } else if (constant instanceof ConstantDouble) {
                    ConstantDouble c = (ConstantDouble) constant;
                    result.append("double\t");
                    result.append(constPool.constantToString(c));
                    result.append(';');
                } else if (constant instanceof ConstantFloat) {
                    ConstantFloat c = (ConstantFloat) constant;
                    result.append("float\t");
                    result.append(constPool.constantToString(c));
                    result.append(';');
                } else if (constant instanceof ConstantInteger) {
                    ConstantInteger c = (ConstantInteger) constant;
                    result.append("int\t");
                    result.append(constPool.constantToString(c));
                    result.append(';');
                } else if (constant instanceof ConstantLong) {
                    ConstantLong c = (ConstantLong) constant;
                    result.append("long\t");
                    result.append(constPool.constantToString(c));
                    result.append(';');
                } else if (constant instanceof ConstantClass) {
                    ConstantClass c = (ConstantClass) constant;
                    result.append("class\t#");
                    result.append(c.getNameIndex());
                    result.append(";\t//  ");
                    result.append(constPool.constantToString(c));
                } else if (constant instanceof ConstantString) {
                    ConstantString c = (ConstantString) constant;
                    result.append("String\t#");
                    result.append(c.getStringIndex());
                    result.append(";\t//  ");
                    result.append(constPool.constantToString(c));
                }

                result.append(n);
View Full Code Here

                    result.append(c.getNameAndTypeIndex());
                    result.append(";\t//  ");
                    result.append(Utility.replace(
                            constPool.constantToString(c), " ", ":"));
                } else if (constant instanceof ConstantDouble) {
                    ConstantDouble c = (ConstantDouble) constant;
                    result.append("double\t");
                    result.append(constPool.constantToString(c));
                    result.append(';');
                } else if (constant instanceof ConstantFloat) {
                    ConstantFloat c = (ConstantFloat) constant;
                    result.append("float\t");
                    result.append(constPool.constantToString(c));
                    result.append(';');
                } else if (constant instanceof ConstantInteger) {
                    ConstantInteger c = (ConstantInteger) constant;
                    result.append("int\t");
                    result.append(constPool.constantToString(c));
                    result.append(';');
                } else if (constant instanceof ConstantLong) {
                    ConstantLong c = (ConstantLong) constant;
                    result.append("long\t");
                    result.append(constPool.constantToString(c));
                    result.append(';');
                } else if (constant instanceof ConstantClass) {
                    ConstantClass c = (ConstantClass) constant;
                    result.append("class\t#");
                    result.append(c.getNameIndex());
                    result.append(";\t//  ");
                    result.append(constPool.constantToString(c));
                } else if (constant instanceof ConstantString) {
                    ConstantString c = (ConstantString) constant;
                    result.append("String\t#");
                    result.append(c.getStringIndex());
                    result.append(";\t//  ");
                    result.append(constPool.constantToString(c));
                }

                result.append(n);
View Full Code Here

     */
    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;
View Full Code Here

        if ((ret = lookupDouble(n)) != -1) {
            return ret; // Already in CP
        }
        adjustSize();
        ret = index;
        constants[index] = new ConstantDouble(n);
        index += 2; // Wastes one entry according to spec
        return ret;
    }
View Full Code Here

      return Integer.toString(c.getBytes());
    case PRIMITIVE_LONG:
      ConstantLong j = (ConstantLong) cpGen.getConstant(idx);
      return Long.toString(j.getBytes());
    case PRIMITIVE_DOUBLE:
      ConstantDouble d = (ConstantDouble) cpGen.getConstant(idx);
      return Double.toString(d.getBytes());
    case PRIMITIVE_FLOAT:
      ConstantFloat f = (ConstantFloat) cpGen.getConstant(idx);
      return Float.toString(f.getBytes());
    case PRIMITIVE_SHORT:
      ConstantInteger s = (ConstantInteger) cpGen.getConstant(idx);
View Full Code Here

TOP

Related Classes of org.apache.bcel.classfile.ConstantDouble

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.