Package org.djunits.formatter
Class FormatContext
java.lang.Object
org.djunits.formatter.FormatContext
- All Implemented Interfaces:
Cloneable
- Direct Known Subclasses:
MatrixFormatContext,QuantityFormatContext,TableFormatContext,VectorFormatContext
FormatContext contains a number of basic settings for formatting a quantity, vector, matrix or quantity table. The settings
deal with the number, unit, and locale. Note that this class and its fields are package private. It is not the intention to
use or extends the class, since the
Format class can only deal with the fields as expressed in this class, and not
with other added fields.
Copyright (c) 2026-2026 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. See for project information https://djunits.org. The DJUNITS project is distributed under a three-clause BSD-style license.
- Author:
- Alexander Verbraeck
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescription(package private) intNumber of decimal digits.(package private) Unit<?,?> Display unit to use.(package private) FormatContext.FloatFormatModeFormat mode.(package private) StringNumber format string.(package private) booleanUse grouping separator (e.g., thousands) or not.(package private) LocaleUsed locale for the entire output string (number and unit).(package private) intmaximum 10th power to use SI prefixes for.(package private) intminimum 10th power to use SI prefixes for.(package private) booleanPrint the reference or not.(package private) StringPostfix to the reference.(package private) StringPrefix to the reference.(package private) booleanUse closest SI prefix.(package private) booleanUse division symbol, e.g., TRUE: kgm2/s2, FALSE: kgm2s-2.(package private) StringSymbol to use for dot separation, e.g., "." to create kg.m2/s2.(package private) StringSymbol to use as the postfix for a power, e.g., "</sup>".(package private) StringSymbol to use as the prefix for a power, e.g., "^" or "<sup>".(package private) booleanSI representation rather than symbol.(package private) booleanTextual representation, e.g., deg instead of degree symbol.(package private) Stringpostfix atring after the unit.(package private) Stringprefix separator between the value and the unit.(package private) StringDisplay unit to use, based on a String representation.(package private) booleanScientific notation: upper case E or lower case e.(package private) intFixed width of the numerical output. -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
formatMode
FormatContext.FloatFormatMode formatModeFormat mode. -
upperE
boolean upperEScientific notation: upper case E or lower case e. -
decimals
int decimalsNumber of decimal digits. -
width
int widthFixed width of the numerical output. -
groupingSeparator
boolean groupingSeparatorUse grouping separator (e.g., thousands) or not. -
formatString
String formatStringNumber format string. -
displayUnit
Unit<?,?> displayUnitDisplay unit to use. -
unitString
String unitStringDisplay unit to use, based on a String representation. -
textual
boolean textualTextual representation, e.g., deg instead of degree symbol. -
siUnits
boolean siUnitsSI representation rather than symbol. -
siDivisionSymbol
boolean siDivisionSymbolUse division symbol, e.g., TRUE: kgm2/s2, FALSE: kgm2s-2. -
siPowerPrefix
String siPowerPrefixSymbol to use as the prefix for a power, e.g., "^" or "<sup>". -
siPowerPostfix
String siPowerPostfixSymbol to use as the postfix for a power, e.g., "</sup>". -
siDotSeparator
String siDotSeparatorSymbol to use for dot separation, e.g., "." to create kg.m2/s2. -
scaleSiPrefixes
boolean scaleSiPrefixesUse closest SI prefix. E.g., turn 20400 m into "20.4 km". -
minimumPrefixPower
int minimumPrefixPowerminimum 10th power to use SI prefixes for. -
maximumPrefixPower
int maximumPrefixPowermaximum 10th power to use SI prefixes for. -
unitPrefix
String unitPrefixprefix separator between the value and the unit. -
unitPostfix
String unitPostfixpostfix atring after the unit. -
printReference
boolean printReferencePrint the reference or not. -
referencePrefix
String referencePrefixPrefix to the reference. -
referencePostfix
String referencePostfixPostfix to the reference. -
locale
Locale localeUsed locale for the entire output string (number and unit).
-
-
Constructor Details
-
FormatContext
FormatContext()
-
-
Method Details