Class FormatContext

java.lang.Object
org.djunits.formatter.FormatContext
All Implemented Interfaces:
Cloneable
Direct Known Subclasses:
MatrixFormatContext, QuantityFormatContext, TableFormatContext, VectorFormatContext

abstract class FormatContext extends Object implements Cloneable
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
  • Field Details

    • formatMode

      Format mode.
    • upperE

      boolean upperE
      Scientific notation: upper case E or lower case e.
    • decimals

      int decimals
      Number of decimal digits.
    • width

      int width
      Fixed width of the numerical output.
    • groupingSeparator

      boolean groupingSeparator
      Use grouping separator (e.g., thousands) or not.
    • formatString

      String formatString
      Number format string.
    • displayUnit

      Unit<?,?> displayUnit
      Display unit to use.
    • unitString

      String unitString
      Display unit to use, based on a String representation.
    • textual

      boolean textual
      Textual representation, e.g., deg instead of degree symbol.
    • siUnits

      boolean siUnits
      SI representation rather than symbol.
    • siDivisionSymbol

      boolean siDivisionSymbol
      Use division symbol, e.g., TRUE: kgm2/s2, FALSE: kgm2s-2.
    • siPowerPrefix

      String siPowerPrefix
      Symbol to use as the prefix for a power, e.g., "^" or "<sup>".
    • siPowerPostfix

      String siPowerPostfix
      Symbol to use as the postfix for a power, e.g., "</sup>".
    • siDotSeparator

      String siDotSeparator
      Symbol to use for dot separation, e.g., "." to create kg.m2/s2.
    • scaleSiPrefixes

      boolean scaleSiPrefixes
      Use closest SI prefix. E.g., turn 20400 m into "20.4 km".
    • minimumPrefixPower

      int minimumPrefixPower
      minimum 10th power to use SI prefixes for.
    • maximumPrefixPower

      int maximumPrefixPower
      maximum 10th power to use SI prefixes for.
    • unitPrefix

      String unitPrefix
      prefix separator between the value and the unit.
    • unitPostfix

      String unitPostfix
      postfix atring after the unit.
    • printReference

      boolean printReference
      Print the reference or not.
    • referencePrefix

      String referencePrefix
      Prefix to the reference.
    • referencePostfix

      String referencePostfix
      Postfix to the reference.
    • locale

      Locale locale
      Used locale for the entire output string (number and unit).
  • Constructor Details

    • FormatContext

      FormatContext()
  • Method Details