View Javadoc
1   package org.djunits.unit;
2   
3   import org.djunits.quantity.Quantity;
4   import org.djunits.unit.scale.IdentityScale;
5   import org.djunits.unit.si.SIPrefixes;
6   import org.djunits.unit.unitsystem.UnitSystem;
7   
8   /**
9    * Objects per unit of distance.
10   * <p>
11   * Copyright (c) 2013-2024 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
12   * BSD-style license. See <a href="https://djunits.org/docs/license.html">DJUNITS License</a>.
13   * </p>
14   * @author <a href="https://www.tudelft.nl/staff/p.knoppers/">Peter Knoppers</a>
15   */
16  public class LinearDensityUnit extends Unit<LinearDensityUnit>
17  {
18      /** */
19      private static final long serialVersionUID = 20141111L;
20  
21      /** The base, with "/m" as the SI signature. */
22      public static final Quantity<LinearDensityUnit> BASE = new Quantity<>("LinearDensity", "m-1");
23  
24      /** The SI unit for objects per unit of distance is 1/meter. */
25      public static final LinearDensityUnit SI = new LinearDensityUnit().build(new Unit.Builder<LinearDensityUnit>()
26              .setQuantity(BASE).setId("/m").setName("per meter").setUnitSystem(UnitSystem.SI_DERIVED)
27              .setSiPrefixes(SIPrefixes.PER_UNIT, 1.0).setScale(IdentityScale.SCALE).setAdditionalAbbreviations("/m", "1/m"));
28  
29      /** 1/meter. */
30      public static final LinearDensityUnit PER_METER = SI;
31  
32      /** 1/&#181;m. */
33      public static final LinearDensityUnit PER_MICROMETER = PER_METER.deriveLinear(1.0E6, "/mum", "per micrometer",
34              UnitSystem.SI_DERIVED, "/\u03BCm", "/mum", "1/\u03BCm", "1/mum");
35  
36      /** 1/millimeter. */
37      public static final LinearDensityUnit PER_MILLIMETER =
38              PER_METER.deriveLinear(1.0E3, "/mm", "per millimeter", UnitSystem.SI_DERIVED, "/mm", "1/mm");
39  
40      /** 1/centimeter. */
41      public static final LinearDensityUnit PER_CENTIMETER =
42              PER_METER.deriveLinear(100.0, "/cm", "per centimeter", UnitSystem.SI_DERIVED, "/cm", "1/cm");
43  
44      /** 1/decimeter. */
45      public static final LinearDensityUnit PER_DECIMETER =
46              PER_METER.deriveLinear(10.0, "/dm", "per decimeter", UnitSystem.SI_DERIVED, "/dm", "1/dm");
47  
48      /** 1/decameter. */
49      public static final LinearDensityUnit PER_DECAMETER =
50              PER_METER.deriveLinear(0.1, "/dam", "per decameter", UnitSystem.SI_DERIVED, "/dam", "1/dam");
51  
52      /** 1/hectometer. */
53      public static final LinearDensityUnit PER_HECTOMETER =
54              PER_METER.deriveLinear(0.01, "/hm", "per hectometer", UnitSystem.SI_DERIVED, "/hm", "1/hm");
55  
56      /** 1/kilometer. */
57      public static final LinearDensityUnit PER_KILOMETER =
58              PER_METER.deriveLinear(0.001, "/km", "per kilometer", UnitSystem.SI_DERIVED, "/km", "1/km");
59  
60      /** 1/foot (international) = 0.3048 m = 1/3 yd = 12 inches. */
61      public static final LinearDensityUnit PER_FOOT =
62              PER_METER.deriveLinear(1.0 / 0.3048, "/ft", "per foot", UnitSystem.IMPERIAL, "/ft", "1/ft");
63  
64      /** 1/inch (international) = 2.54 cm = 1/36 yd = 1/12 ft. */
65      public static final LinearDensityUnit PER_INCH =
66              PER_FOOT.deriveLinear(12.0, "/in", "per inch", UnitSystem.IMPERIAL, "/in", "1/in");
67  
68      /** 1/yard (international) = 0.9144 m = 3 ft = 36 in. */
69      public static final LinearDensityUnit PER_YARD =
70              PER_FOOT.deriveLinear(1.0 / 3.0, "/yd", "per yard", UnitSystem.IMPERIAL, "/yd", "1/yd");
71  
72      /** 1/mile (international) = 5280 ft = 1760 yd. */
73      public static final LinearDensityUnit PER_MILE =
74              PER_FOOT.deriveLinear(1.0 / 5280.0, "/mi", "per mile", UnitSystem.IMPERIAL, "/mi", "1/mi");
75  
76      /** 1/nautical mile (international) = 1852 m. */
77      public static final LinearDensityUnit PER_NAUTICAL_MILE =
78              PER_METER.deriveLinear(1.0 / 1852.0, "/NM", "per Nautical Mile", UnitSystem.OTHER, "/NM", "1/NM");
79  
80      /** 1/Astronomical Unit. */
81      public static final LinearDensityUnit PER_ASTRONOMICAL_UNIT =
82              PER_METER.deriveLinear(1.0 / 149597870700.0, "/AU", "per Astronomical Unit", UnitSystem.OTHER, "/AU", "1/AU");
83  
84      /** 1/Lightyear. */
85      public static final LinearDensityUnit PER_LIGHTYEAR =
86              PER_METER.deriveLinear(1.0 / 9460730472580800.0, "/ly", "per lightyear", UnitSystem.OTHER, "/ly", "1/ly");
87  
88      /** 1/Parsec. */
89      public static final LinearDensityUnit PER_PARSEC =
90              PER_LIGHTYEAR.deriveLinear(Math.PI / 648000.0, "/pc", "per parsec", UnitSystem.OTHER, "/pc", "1/pc");
91  
92      /** 1/Angstrom. */
93      public static final LinearDensityUnit PER_ANGSTROM =
94              PER_METER.deriveLinear(1.0E-10, "/A", "per Angstrom", UnitSystem.OTHER, "/\u212B", "/A", "1/\u212B", "1/A");
95  
96  }