Class DoubleFormat.AbstractDoubleFormat

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private boolean alwaysIncludeExponent
      Flag indicating if exponent values should always be included, even if zero.
      private char decimalSeparator
      Decimal separator character.
      private char[] digits
      String containing the digits 0-9.
      private char[] exponentSeparatorChars
      Exponent separator character.
      private boolean fractionPlaceholder
      Flag determining if fraction placeholders should be used.
      private char groupingSeparator
      Thousands grouping separator.
      private boolean groupThousands
      Flag indicating if thousands should be grouped.
      private int maxPrecision
      Maximum precision; 0 indicates no limit.
      private int minDecimalExponent
      Minimum decimal exponent.
      private char minusSign
      Minus sign character.
      private java.lang.String nan
      String representing NaN.
      private java.lang.String negativeInfinity
      String representing negative infinity.
      private java.lang.String positiveInfinity
      String representing positive infinity.
      private boolean signedZero
      Flag determining if signed zero strings are allowed.
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String apply​(double d)
      private java.lang.String applyFinite​(double d)
      Returns a formatted string representation of the given finite value.
      protected abstract java.lang.String applyFiniteInternal​(ParsedDecimal val)
      Returns a formatted representation of the given rounded decimal value to dst.
      char getDecimalSeparator()
      Get the decimal separator character.
      char[] getDigits()
      Get an array containing the localized digit characters 0-9 in that order.
      char[] getExponentSeparatorChars()
      Get the exponent separator as an array of characters.
      char getGroupingSeparator()
      Get the character used to separate thousands groupings.
      char getMinusSign()
      Get the minus sign character.
      boolean isAlwaysIncludeExponent()
      Return true if exponent values should always be included in formatted output, even if the value is zero.
      boolean isGroupThousands()
      Return true if thousands should be grouped.
      boolean isIncludeFractionPlaceholder()
      Return true if fraction placeholders (e.g., ".0" in "1.0") should be included.
      boolean isSignedZero()
      Return true if the string zero should be prefixed with the minus sign for negative zero values.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • maxPrecision

        private final int maxPrecision
        Maximum precision; 0 indicates no limit.
      • minDecimalExponent

        private final int minDecimalExponent
        Minimum decimal exponent.
      • positiveInfinity

        private final java.lang.String positiveInfinity
        String representing positive infinity.
      • negativeInfinity

        private final java.lang.String negativeInfinity
        String representing negative infinity.
      • nan

        private final java.lang.String nan
        String representing NaN.
      • fractionPlaceholder

        private final boolean fractionPlaceholder
        Flag determining if fraction placeholders should be used.
      • signedZero

        private final boolean signedZero
        Flag determining if signed zero strings are allowed.
      • digits

        private final char[] digits
        String containing the digits 0-9.
      • decimalSeparator

        private final char decimalSeparator
        Decimal separator character.
      • groupingSeparator

        private final char groupingSeparator
        Thousands grouping separator.
      • groupThousands

        private final boolean groupThousands
        Flag indicating if thousands should be grouped.
      • minusSign

        private final char minusSign
        Minus sign character.
      • exponentSeparatorChars

        private final char[] exponentSeparatorChars
        Exponent separator character.
      • alwaysIncludeExponent

        private final boolean alwaysIncludeExponent
        Flag indicating if exponent values should always be included, even if zero.
    • Constructor Detail

      • AbstractDoubleFormat

        AbstractDoubleFormat​(DoubleFormat.Builder builder)
        Constructs a new instance.
        Parameters:
        builder - builder instance containing configuration values
    • Method Detail

      • apply

        public java.lang.String apply​(double d)
        Specified by:
        apply in interface java.util.function.DoubleFunction<java.lang.String>
      • applyFinite

        private java.lang.String applyFinite​(double d)
        Returns a formatted string representation of the given finite value.
        Parameters:
        d - double value
      • applyFiniteInternal

        protected abstract java.lang.String applyFiniteInternal​(ParsedDecimal val)
        Returns a formatted representation of the given rounded decimal value to dst.
        Parameters:
        val - value to format
        Returns:
        a formatted representation of the given rounded decimal value to dst.
      • getDigits

        public char[] getDigits()
        Get an array containing the localized digit characters 0-9 in that order. This string must be non-null and have a length of 10.
        Specified by:
        getDigits in interface ParsedDecimal.FormatOptions
        Returns:
        array containing the digit characters 0-9
      • getExponentSeparatorChars

        public char[] getExponentSeparatorChars()
        Get the exponent separator as an array of characters.
        Specified by:
        getExponentSeparatorChars in interface ParsedDecimal.FormatOptions
        Returns:
        exponent separator as an array of characters
      • getGroupingSeparator

        public char getGroupingSeparator()
        Get the character used to separate thousands groupings.
        Specified by:
        getGroupingSeparator in interface ParsedDecimal.FormatOptions
        Returns:
        character used to separate thousands groupings
      • isAlwaysIncludeExponent

        public boolean isAlwaysIncludeExponent()
        Return true if exponent values should always be included in formatted output, even if the value is zero.
        Specified by:
        isAlwaysIncludeExponent in interface ParsedDecimal.FormatOptions
        Returns:
        true if exponent values should always be included
      • isGroupThousands

        public boolean isGroupThousands()
        Return true if thousands should be grouped.
        Specified by:
        isGroupThousands in interface ParsedDecimal.FormatOptions
        Returns:
        true if thousand should be grouped
      • isIncludeFractionPlaceholder

        public boolean isIncludeFractionPlaceholder()
        Return true if fraction placeholders (e.g., ".0" in "1.0") should be included.
        Specified by:
        isIncludeFractionPlaceholder in interface ParsedDecimal.FormatOptions
        Returns:
        true if fraction placeholders should be included
      • isSignedZero

        public boolean isSignedZero()
        Return true if the string zero should be prefixed with the minus sign for negative zero values.
        Specified by:
        isSignedZero in interface ParsedDecimal.FormatOptions
        Returns:
        true if the minus zero string should be allowed