View Javadoc
1   package org.djunits.unit;
2   
3   import static org.djunits.unit.unitsystem.UnitSystem.OTHER;
4   
5   import org.djunits.unit.unitsystem.UnitSystem;
6   
7   /**
8    * Dimensionless unit.
9    * <p>
10   * Copyright (c) 2015-2018 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
11   * BSD-style license. See <a href="http://djunits.org/docs/license.html">DJUNITS License</a>.
12   * <p>
13   * $LastChangedDate: 2018-01-28 03:17:44 +0100 (Sun, 28 Jan 2018) $, @version $Revision: 256 $, by $Author: averbraeck $,
14   * initial version Jun 5, 2014 <br>
15   * @author <a href="http://www.tbm.tudelft.nl/averbraeck">Alexander Verbraeck</a>
16   */
17  public final class DimensionlessUnit extends Unit<DimensionlessUnit>
18  {
19      /** */
20      private static final long serialVersionUID = 20150830L;
21  
22      /** The SI unit for a dimensionless unit is "1" or N/A. */
23      public static final DimensionlessUnit SI;
24  
25      static
26      {
27          SI = new DimensionlessUnit("DimensionlessUnit.si", "DimensionlessUnit.si", OTHER);
28      }
29  
30      /**
31       * @param nameKey the key to the locale file for the long name of the unit
32       * @param abbreviationKey the key to the locale file for the abbreviation of the unit
33       * @param unitSystem the unit system, e.g. SI or Imperial
34       */
35      private DimensionlessUnit(final String nameKey, final String abbreviationKey, final UnitSystem unitSystem)
36      {
37          super(nameKey, abbreviationKey, unitSystem, true);
38      }
39  
40      /** {@inheritDoc} */
41      @Override
42      public DimensionlessUnit getStandardUnit()
43      {
44          return SI;
45      }
46  
47      /** {@inheritDoc} */
48      @Override
49      public String getSICoefficientsString()
50      {
51          return "1";
52      }
53  
54  }