1 package org.opentrafficsim.core.unit;
2
3 import static org.opentrafficsim.core.unit.unitsystem.UnitSystem.IMPERIAL;
4 import static org.opentrafficsim.core.unit.unitsystem.UnitSystem.SI_BASE;
5
6 import org.opentrafficsim.core.unit.unitsystem.UnitSystem;
7
8
9
10
11
12
13
14
15
16
17
18 public class LengthUnit extends Unit<LengthUnit>
19 {
20
21 private static final long serialVersionUID = 20140607L;
22
23
24 public static final LengthUnit SI;
25
26
27 public static final LengthUnit METER;
28
29
30 public static final LengthUnit MILLIMETER;
31
32
33 public static final LengthUnit CENTIMETER;
34
35
36 public static final LengthUnit DECIMETER;
37
38
39 public static final LengthUnit DEKAMETER;
40
41
42 public static final LengthUnit HECTOMETER;
43
44
45 public static final LengthUnit KILOMETER;
46
47
48 public static final LengthUnit FOOT;
49
50
51 public static final LengthUnit INCH;
52
53
54 public static final LengthUnit MILE;
55
56
57 public static final LengthUnit NAUTICAL_MILE;
58
59
60 public static final LengthUnit YARD;
61
62 static
63 {
64 SI = new LengthUnit("LengthUnit.meter", "LengthUnit.m", SI_BASE);
65 METER = SI;
66 MILLIMETER = new LengthUnit("LengthUnit.millimeter", "LengthUnit.mm", SI_BASE, METER, 0.001);
67 CENTIMETER = new LengthUnit("LengthUnit.centimeter", "LengthUnit.cm", SI_BASE, METER, 0.01);
68 DECIMETER = new LengthUnit("LengthUnit.decimeter", "LengthUnit.dm", SI_BASE, METER, 0.1);
69 DEKAMETER = new LengthUnit("LengthUnit.dekameter", "LengthUnit.dam", SI_BASE, METER, 10.0);
70 HECTOMETER = new LengthUnit("LengthUnit.hectometer", "LengthUnit.hm", SI_BASE, METER, 100.0);
71 KILOMETER = new LengthUnit("LengthUnit.kilometer", "LengthUnit.km", SI_BASE, METER, 1000.0);
72 FOOT = new LengthUnit("LengthUnit.foot", "LengthUnit.ft", IMPERIAL, METER, 0.3048);
73 INCH = new LengthUnit("LengthUnit.inch", "LengthUnit.in", IMPERIAL, FOOT, 1.0 / 12.0);
74 MILE = new LengthUnit("LengthUnit.mile", "LengthUnit.mi", IMPERIAL, FOOT, 5280.0);
75 NAUTICAL_MILE = new LengthUnit("LengthUnit.nauticalMile", "LengthUnit.NM", IMPERIAL, METER, 1852.0);
76 YARD = new LengthUnit("LengthUnit.yard", "LengthUnit.yd", IMPERIAL, FOOT, 3.0);
77 }
78
79
80
81
82
83
84
85 public LengthUnit(final String nameKey, final String abbreviationKey, final UnitSystem unitSystem)
86 {
87 super(nameKey, abbreviationKey, unitSystem, true);
88 }
89
90
91
92
93
94
95
96
97
98
99 public LengthUnit(final String nameKey, final String abbreviationKey, final UnitSystem unitSystem,
100 final LengthUnit referenceUnit, final double conversionFactorToReferenceUnit)
101 {
102 super(nameKey, abbreviationKey, unitSystem, referenceUnit, conversionFactorToReferenceUnit, true);
103 }
104
105
106 @Override
107 public final LengthUnit getStandardUnit()
108 {
109 return METER;
110 }
111
112
113 @Override
114 public final String getSICoefficientsString()
115 {
116 return "m";
117 }
118
119 }