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
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
    The format mode.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    (package private) int
    Number of decimal digits.
    (package private) Unit<?,?>
    Display unit to use.
    Format mode.
    (package private) String
    Number format string.
    (package private) boolean
    Use grouping separator (e.g., thousands) or not.
    (package private) Locale
    Used locale for the entire output string (number and unit).
    (package private) int
    Maximum number of significant digits to show for variable length format.
    (package private) boolean
    Print the reference or not.
    (package private) String
    Postfix to the reference.
    (package private) String
    Prefix to the reference.
    (package private) int
    Scientific threshold for scientific notation (has to be negative); only used for variable length format.
    (package private) boolean
    Use division symbol, e.g., TRUE: kgm2/s2, FALSE: kgm2s-2.
    (package private) String
    Symbol to use for dot separation, e.g., "." to create kg.m2/s2.
    (package private) String
    Symbol to use as the postfix for a power, e.g., "</sup>".
    (package private) String
    Symbol to use as the prefix for a power, e.g., "^" or "<sup>".
    (package private) boolean
    SI representation rather than symbol.
    (package private) boolean
    Textual representation, e.g., deg instead of degree symbol.
    (package private) String
    postfix atring after the unit.
    (package private) String
    prefix separator between the value and the unit.
    (package private) String
    Display unit to use, based on a String representation.
    (package private) boolean
    Scientific notation: upper case E or lower case e.
    (package private) int
    Fixed width of the numerical output.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected FormatContext
     

    Methods inherited from class java.lang.Object

    equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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.
    • maxSigDigits

      int maxSigDigits
      Maximum number of significant digits to show for variable length format.
    • sciThreshold

      int sciThreshold
      Scientific threshold for scientific notation (has to be negative); only used for variable length format.
    • 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.
    • 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