View Javadoc
1   package org.djunits.formatter;
2   
3   /**
4    * QuantityFormatContext contains a number of settings for formatting a quantity. Note that this class and its fields are
5    * package private. It is not the intention to use or extends the class, since the {@link QuantityFormat} class can only deal
6    * with the fields as expressed in this class, and not with other added fields.
7    * <p>
8    * Copyright (c) 2026-2026 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. See
9    * for project information <a href="https://djunits.org" target="_blank">https://djunits.org</a>. The DJUNITS project is
10   * distributed under a <a href="https://djunits.org/docs/license.html" target="_blank">three-clause BSD-style license</a>.
11   * @author Alexander Verbraeck
12   */
13  @SuppressWarnings("checkstyle:visibilitymodifier")
14  class QuantityFormatContext extends FormatContext implements Cloneable
15  {
16      // Quantity formatting from QuantityFormat, contains default values
17  
18      /** if true use automatic allocation of the unit to its closest SI prefix. E.g., turn 20400 m into "20.4 km". */
19      boolean autoSiPrefix = false;
20  
21      /** minimum exponent for the 10-power in scientific notation to use SI prefixes for (inclusive). */
22      int autoSiMinExponent = -30;
23  
24      /** maximum exponent for the 10-power in scientific notation to use SI prefixes for (inclusive). */
25      int autoSiMaxExponent = +30;
26      
27      /** Allow c, d, da and h prefixes? */
28      boolean allowExponents12 = false;
29  
30      @Override
31      protected QuantityFormatContext clone()
32      {
33          return (QuantityFormatContext) super.clone();
34      }
35  
36  }