1 package org.djunits.unit;
2
3 import org.djunits.unit.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
10
11
12
13
14
15
16
17 public class LengthUnit extends Unit<LengthUnit>
18 {
19
20 private static final long serialVersionUID = 20190818L;
21
22
23 public static final Quantity<LengthUnit> BASE = new Quantity<>("Length", "m");
24
25
26 public static final LengthUnit SI =
27 new LengthUnit().build(new Unit.Builder<LengthUnit>().setQuantity(BASE).setId("m").setName("meter")
28 .setUnitSystem(UnitSystem.SI_BASE).setSiPrefixes(SIPrefixes.UNIT, 1.0).setScale(IdentityScale.SCALE));
29
30
31 public static final LengthUnit METER = SI;
32
33
34 public static final LengthUnit NANOMETER = METER.deriveSI(SIPrefixes.getUnit("n"), 1.0);
35
36
37 public static final LengthUnit MICROMETER = METER.deriveSI(SIPrefixes.getUnit("mu"), 1.0);
38
39
40 public static final LengthUnit MILLIMETER = METER.deriveSI(SIPrefixes.getUnit("m"), 1.0);
41
42
43 public static final LengthUnit CENTIMETER = METER.deriveSI(SIPrefixes.getUnit("c"), 1.0);
44
45
46 public static final LengthUnit DECIMETER = METER.deriveSI(SIPrefixes.getUnit("d"), 1.0);
47
48
49 public static final LengthUnit DECAMETER = METER.deriveSI(SIPrefixes.getUnit("da"), 1.0);
50
51
52 public static final LengthUnit HECTOMETER = METER.deriveSI(SIPrefixes.getUnit("h"), 1.0);
53
54
55 public static final LengthUnit KILOMETER = METER.deriveSI(SIPrefixes.getUnit("k"), 1.0);
56
57
58 public static final LengthUnit FOOT = METER.deriveLinear(0.3048, "ft", "foot", UnitSystem.IMPERIAL);
59
60
61 public static final LengthUnit INCH = FOOT.deriveLinear(1.0 / 12.0, "in", "inch");
62
63
64 public static final LengthUnit YARD = FOOT.deriveLinear(3.0, "yd", "yard");
65
66
67 public static final LengthUnit MILE = FOOT.deriveLinear(5280.0, "mi", "mile");
68
69
70 public static final LengthUnit NAUTICAL_MILE = METER.deriveLinear(1852.0, "NM", "nautical mile", UnitSystem.OTHER);
71
72
73 public static final LengthUnit ASTRONOMICAL_UNIT =
74 METER.deriveLinear(149_597_870_700.0, "AU", "Astronomical Unit", UnitSystem.OTHER);
75
76
77 public static final LengthUnit LIGHTYEAR = METER.deriveLinear(9_460_730_472_580_800.0, "ly", "lightyear", UnitSystem.OTHER);
78
79
80 public static final LengthUnit PARSEC = LIGHTYEAR.deriveLinear(648_000.0 / Math.PI, "Pc", "Parsec");
81
82
83 public static final LengthUnit ANGSTROM = METER.deriveLinear(1.0E-10, "A", "Angstrom", UnitSystem.OTHER, "\u212B", "A");
84
85 }