Class AbstractDifferenceFormatter

  • Direct Known Subclasses:
    TimeDifferenceFormatter

    public abstract class AbstractDifferenceFormatter
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      AbstractDifferenceFormatter​(java.lang.String pattern, boolean spaceAfterValue)
      Constructor
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      protected java.lang.String addResult​(long value, java.lang.String trailer, java.lang.String result)
      Gets a prepared string which contains the result and additional the given value
      java.lang.String formatAsString​(double value)
      Formats the given value to a well formated string
      java.lang.String formatAsString​(double value, int len)
      Formats the given value to a well formated string
      abstract java.lang.String formatAsString​(long value)
      Formats the given value to a well formated string
      java.lang.String formatAsString​(long value, int len)
      Formats the given value to a well formated string
      java.lang.String formatNumber​(double number, java.lang.String trailer, boolean space)
      Formats a given number
      protected java.lang.String formatNumber​(long number, java.lang.String trailer, boolean space)
      Formats a given number
      protected java.text.DecimalFormat getDecimalFormatter()
      Get the decimal formatter
      protected boolean spaceAfterValue()
      Defines if after a value follows a space
      • Methods inherited from class java.lang.Object

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

      • AbstractDifferenceFormatter

        public AbstractDifferenceFormatter​(java.lang.String pattern,
                                           boolean spaceAfterValue)
        Constructor
        Parameters:
        pattern - the format pattern
        spaceAfterValue - true to have a space after the value
    • Method Detail

      • formatAsString

        public java.lang.String formatAsString​(double value,
                                               int len)
        Formats the given value to a well formated string
        Parameters:
        value - the value difference
        len - the size of the string
        Returns:
        the formated string
      • formatAsString

        public java.lang.String formatAsString​(long value,
                                               int len)
        Formats the given value to a well formated string
        Parameters:
        value - the value difference
        len - the size of the string
        Returns:
        the formated string
      • formatAsString

        public java.lang.String formatAsString​(double value)
        Formats the given value to a well formated string
        Parameters:
        value - the value difference
        Returns:
        the formated string
      • formatAsString

        public abstract java.lang.String formatAsString​(long value)
        Formats the given value to a well formated string
        Parameters:
        value - the value difference
        Returns:
        the formated string
      • formatNumber

        public java.lang.String formatNumber​(double number,
                                             java.lang.String trailer,
                                             boolean space)
        Formats a given number
        Parameters:
        number - the number to format
        trailer - the tailer
        space - add space between number and trailer
        Returns:
        the formated number
      • formatNumber

        protected java.lang.String formatNumber​(long number,
                                                java.lang.String trailer,
                                                boolean space)
        Formats a given number
        Parameters:
        number - the number to format
        trailer - the tailer
        space - add space between number and trailer
        Returns:
        the formated number
      • addResult

        protected java.lang.String addResult​(long value,
                                             java.lang.String trailer,
                                             java.lang.String result)
        Gets a prepared string which contains the result and additional the given value
        Parameters:
        value - the value
        trailer - the trailer
        result - the current result
        Returns:
        the prepared string
      • getDecimalFormatter

        protected java.text.DecimalFormat getDecimalFormatter()
        Get the decimal formatter
        Returns:
        the decimal formatter
      • spaceAfterValue

        protected boolean spaceAfterValue()
        Defines if after a value follows a space
        Returns:
        true to add space after the value