Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4178836

(porting) Shared code OpenVMS Alpha mods, zeroDigitCount mods in applyPattern

    XMLWordPrintable

Details

    • generic
    • generic

    Description

      For the JDK 116 release on the OpenVMS Alpha platform running on DIGITAL's
      Alpha hardware, DIGITAL has changed the following JDK 116 source file in the shared part of the JDK.

       src/share/java/java/text/DecimalFormat.java

      diff -c -r JDK116/src/share/java/java/text/DecimalFormat.java
      sun_JDK116/src/share/java/java/text/DecimalFormat.java
      *** JDK116/src/share/java/java/text/DecimalFormat.java Thu Jul 2 08:08:47 1998
      --- sun_JDK116/src/share/java/java/text/DecimalFormat.java Thu Apr 16
      13:51:34 1998
      ***************
      *** 1490,1510 ****
                // Handle patterns with no '0' pattern character. These patterns
                // are legal, but must be interpreted. "##.###" -> "#0.###".
                // ".###" -> ".0##".
      ! /* We allow patterns of the form "####" to produce a zeroDigitCount of
      ! * zero (got that?); although this seems like it might make it
      possible
      ! * for format() to produce empty strings, format() checks for this
      ! * condition and outputs a zero digit in this situation. Having a
      ! * zeroDigitCount of zero yields a minimum integer digits of zero,
      which
      ! * allows proper round-trip patterns. That is, we don't want "#" to
      ! * become "#0" when toPattern() is called (even though that's what it
      ! * really is, semantically). */
      ! if (zeroDigitCount == 0 && digitLeftCount > 0 &&
      ! decimalPos >= 0) { // Handle "###.###" and "###." and ".###"
      ! int n = decimalPos;
      ! if (n == 0) ++n; // Handle ".###"
      ! digitRightCount = digitLeftCount - n;
      ! digitLeftCount = n - 1;
      ! zeroDigitCount = 1;
                }
        
                // Do syntax checking on the digits.
      --- 1490,1506 ----
                // Handle patterns with no '0' pattern character. These patterns
                // are legal, but must be interpreted. "##.###" -> "#0.###".
                // ".###" -> ".0##".
      ! if (zeroDigitCount == 0 && digitLeftCount > 0)
      ! {
      ! if (decimalPos >= 0) // Handle "###.###" and "###." and ".###"
      ! {
      ! int n = decimalPos;
      ! if (n == 0) ++n; // Handle ".###"
      ! digitRightCount = digitLeftCount - n;
      ! digitLeftCount = n - 1;
      ! }
      ! else --digitLeftCount; // Handle "###"
      ! zeroDigitCount = 1;
                }
        
                // Do syntax checking on the digits.
      ***************
      *** 1523,1533 ****
                        this.negativePrefix = positivePrefix; // assume these for
      now
                        this.negativeSuffix = positiveSuffix;
                    int digitTotalCount = digitLeftCount + zeroDigitCount +
      digitRightCount;
      ! /* The effectiveDecimalPos is the position the decimal is at or
      ! * would be at if there is no decimal. Note that if decimalPos<0,
      ! * then digitTotalCount == digitLeftCount + zeroDigitCount. */
      ! int effectiveDecimalPos = decimalPos >= 0 ? decimalPos :
      digitTotalCount;
      ! setMinimumIntegerDigits(effectiveDecimalPos - digitLeftCount);
                    setMaximumIntegerDigits(useExponentialNotation ?
                                digitLeftCount + getMinimumIntegerDigits() : 127);
                    setMaximumFractionDigits(decimalPos >= 0 ? (digitTotalCount -
      decimalPos) : 0);
      --- 1519,1532 ----
                        this.negativePrefix = positivePrefix; // assume these for
      now
                        this.negativeSuffix = positiveSuffix;
                    int digitTotalCount = digitLeftCount + zeroDigitCount +
      digitRightCount;
      ! setMinimumIntegerDigits(decimalPos >= 0 ? (decimalPos -
      digitLeftCount) : 0);
      ! // Handles the "0000" like patterns by recording the correct
      decimal
      ! // position. HShih
      ! if (zeroDigitCount > 1 && digitLeftCount == 0 && digitRightCount
      == 0)
      ! setMinimumIntegerDigits(zeroDigitCount);
      ! // Handles "#,##0" and "#,000" correctly
      ! else if (zeroDigitCount > 0 && digitLeftCount > 0 &&
      zeroDigitCount != digitLeftCount && (digitTotalCount == digitLeftCount +
      zeroDigitCount))
      ! setMinimumIntegerDigits(zeroDigitCount);
                    setMaximumIntegerDigits(useExponentialNotation ?
                                digitLeftCount + getMinimumIntegerDigits() : 127);
                    setMaximumFractionDigits(decimalPos >= 0 ? (digitTotalCount -
      decimalPos) : 0);

      Attachments

        Activity

          People

            aliusunw Alan Liu (Inactive)
            jbenoit Jonathan Benoit (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: