Class AbstractDifferenceFormatter
java.lang.Object
com.github.toolarium.common.formatter.AbstractDifferenceFormatter
- Direct Known Subclasses:
TimeDifferenceFormatter
-
Constructor Summary
ConstructorsConstructorDescriptionAbstractDifferenceFormatter(String pattern, boolean spaceAfterValue) Constructor -
Method Summary
Modifier and TypeMethodDescriptionprotected StringGets a prepared string which contains the result and additional the given valueformatAsString(double value) Formats the given value to a well formated stringformatAsString(double value, int len) Formats the given value to a well formated stringabstract StringformatAsString(long value) Formats the given value to a well formated stringformatAsString(long value, int len) Formats the given value to a well formated stringformatNumber(double number, String trailer, boolean space) Formats a given numberprotected StringformatNumber(long number, String trailer, boolean space) Formats a given numberprotected DecimalFormatGet the decimal formatterprotected booleanDefines if after a value follows a space
-
Constructor Details
-
AbstractDifferenceFormatter
Constructor- Parameters:
pattern- the format patternspaceAfterValue- true to have a space after the value
-
-
Method Details
-
formatAsString
Formats the given value to a well formated string- Parameters:
value- the value differencelen- the size of the string- Returns:
- the formated string
-
formatAsString
Formats the given value to a well formated string- Parameters:
value- the value differencelen- the size of the string- Returns:
- the formated string
-
formatAsString
Formats the given value to a well formated string- Parameters:
value- the value difference- Returns:
- the formated string
-
formatAsString
Formats the given value to a well formated string- Parameters:
value- the value difference- Returns:
- the formated string
-
formatNumber
Formats a given number- Parameters:
number- the number to formattrailer- the tailerspace- add space between number and trailer- Returns:
- the formated number
-
formatNumber
Formats a given number- Parameters:
number- the number to formattrailer- the tailerspace- add space between number and trailer- Returns:
- the formated number
-
addResult
Gets a prepared string which contains the result and additional the given value- Parameters:
value- the valuetrailer- the trailerresult- the current result- Returns:
- the prepared string
-
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
-