Class InstantPatternDynamicFormatter.SecondPatternSequence

    • Field Detail

      • POWERS_OF_TEN

        private static final int[] POWERS_OF_TEN
      • secondDigits

        private final int secondDigits
      • separator

        private final java.lang.String separator
      • fractionalDigits

        private final int fractionalDigits
    • Constructor Detail

      • SecondPatternSequence

        SecondPatternSequence​(int secondDigits,
                              java.lang.String separator,
                              int fractionalDigits)
    • Method Detail

      • createPattern

        private static java.lang.String createPattern​(int secondDigits,
                                                      java.lang.String separator,
                                                      int fractionalDigits)
      • determinePrecision

        private static java.time.temporal.ChronoUnit determinePrecision​(int secondDigits,
                                                                        int digits)
      • formatUnpaddedSeconds

        private static void formatUnpaddedSeconds​(java.lang.StringBuilder buffer,
                                                  Instant instant)
      • formatPaddedSeconds

        private static void formatPaddedSeconds​(java.lang.StringBuilder buffer,
                                                Instant instant)
      • formatFractionalDigits

        private void formatFractionalDigits​(java.lang.StringBuilder buffer,
                                            Instant instant)
      • formatMillis

        private static void formatMillis​(java.lang.StringBuilder buffer,
                                         Instant instant)
      • tryMerge

        @Nullable InstantPatternDynamicFormatter.PatternSequence tryMerge​(InstantPatternDynamicFormatter.PatternSequence other,
                                                                          java.time.temporal.ChronoUnit thresholdPrecision)
        Description copied from class: InstantPatternDynamicFormatter.PatternSequence
        Tries to merge two pattern sequences.

        If not {@link null}, the pattern sequence returned by this method must:

        1. Have a InstantPatternDynamicFormatter.PatternSequence.precision, which is the minimum of the precisions of the two merged sequences.
        2. Create formatters that are equivalent to the concatenation of the formatters produced by the two merged sequences.

        The returned pattern sequence should try to achieve these two goals:

        1. Create formatters which are faster than the concatenation of the formatters produced by the two merged sequences.
        2. It should be {@link null} if one of the pattern sequences is effectively constant over thresholdPrecision, but the other one is not.
        Specified by:
        tryMerge in class InstantPatternDynamicFormatter.PatternSequence
        Parameters:
        other - A pattern sequence.
        thresholdPrecision - A precision threshold to determine effectively constant sequences. This prevents merging effectively constant and dynamic pattern sequences.
        Returns:
        A merged formatter factory or null if merging is not possible.