jeremias    2003/02/16 04:39:49

  Modified:    src/org/apache/fop/pdf Tag: fop-0_20_2-maintain
                        PDFNumber.java
  Log:
  Removed some unnecessary duplicate code.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.5.2.1   +5 -33     xml-fop/src/org/apache/fop/pdf/PDFNumber.java
  
  Index: PDFNumber.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/pdf/PDFNumber.java,v
  retrieving revision 1.5
  retrieving revision 1.5.2.1
  diff -u -r1.5 -r1.5.2.1
  --- PDFNumber.java    30 Jul 2001 20:29:30 -0000      1.5
  +++ PDFNumber.java    16 Feb 2003 12:39:49 -0000      1.5.2.1
  @@ -1,6 +1,6 @@
   /*
    * $Id$
  - * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
  + * Copyright (C) 2001-2003 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
    */
  @@ -9,39 +9,11 @@
   
   public class PDFNumber {
   
  -    private PDFNumber() {}
  -
       public static String doubleOut(Double doubleDown) {
  -        StringBuffer p = new StringBuffer();
  -        if (doubleDown.doubleValue() < 0) {
  -            doubleDown = new Double(-doubleDown.doubleValue());
  -            p.append("-");
  -        }
  -        double trouble = doubleDown.doubleValue() % 1;
  -        if (trouble > 0.950) {
  -            p.append(doubleDown.intValue() + 1);
  -        } else if (trouble < 0.050) {
  -            p.append(doubleDown.intValue());
  -        } else {
  -            String doubleString = new String(doubleDown + "");
  -            int decimal = doubleString.indexOf(".");
  -            if (decimal != -1) {
  -                p.append(doubleString.substring(0, decimal));
  -
  -                if ((doubleString.length() - decimal) > 6) {
  -                    p.append(doubleString.substring(decimal, decimal + 6));
  -                } else {
  -                    p.append(doubleString.substring(decimal));
  -                }
  -            } else {
  -                p.append(doubleString);
  -            }
  -        }
  -        return (p.toString());
  +        return doubleOut(doubleDown.doubleValue());
       }
   
       public static String doubleOut(double doubleDown) {
  -
           StringBuffer p = new StringBuffer();
           if (doubleDown < 0) {
               doubleDown = -doubleDown;
  @@ -54,7 +26,7 @@
           } else if (trouble < 0.050) {
               p.append((int)doubleDown);
           } else {
  -            String doubleString = new String(doubleDown + "");
  +            String doubleString = Double.toString(doubleDown);
               int decimal = doubleString.indexOf(".");
               if (decimal != -1) {
                   p.append(doubleString.substring(0, decimal));
  @@ -85,7 +57,7 @@
           } else if (trouble < (5.0 / (Math.pow(10.0, dec)))) {
               p.append((int)doubleDown);
           } else {
  -            String doubleString = new String(doubleDown + "");
  +            String doubleString = Double.toString(doubleDown);
               int decimal = doubleString.indexOf(".");
               if (decimal != -1) {
                   p.append(doubleString.substring(0, decimal));
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to