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_DERIVED;
5
6 import org.opentrafficsim.core.unit.unitsystem.UnitSystem;
7
8
9
10
11
12
13
14
15
16
17 public class FlowMassUnit extends Unit<FlowMassUnit>
18 {
19
20 private static final long serialVersionUID = 20140607L;
21
22
23 private final MassUnit massUnit;
24
25
26 private final TimeUnit timeUnit;
27
28
29 public static final FlowMassUnit SI;
30
31
32 public static final FlowMassUnit KILOGRAM_PER_SECOND;
33
34
35 public static final FlowMassUnit POUND_PER_SECOND;
36
37 static
38 {
39 SI =
40 new FlowMassUnit(MassUnit.KILOGRAM, TimeUnit.SECOND, "FlowMassUnit.kilogram_per_second",
41 "FlowMassUnit.kg/s", SI_DERIVED);
42 KILOGRAM_PER_SECOND = SI;
43 POUND_PER_SECOND =
44 new FlowMassUnit(MassUnit.POUND, TimeUnit.SECOND, "FlowMassUnit.pound_per_second", "FlowMassUnit.lb/s",
45 IMPERIAL);
46 }
47
48
49
50
51
52
53
54
55
56 public FlowMassUnit(final MassUnit massUnit, final TimeUnit timeUnit, final String nameKey,
57 final String abbreviationKey, final UnitSystem unitSystem)
58 {
59 super(nameKey, abbreviationKey, unitSystem, KILOGRAM_PER_SECOND, massUnit.getConversionFactorToStandardUnit()
60 / timeUnit.getConversionFactorToStandardUnit(), true);
61 this.massUnit = massUnit;
62 this.timeUnit = timeUnit;
63 }
64
65
66
67
68
69
70
71
72
73
74 public FlowMassUnit(final String nameKey, final String abbreviationKey, final UnitSystem unitSystem,
75 final FlowMassUnit referenceUnit, final double conversionFactorToReferenceUnit)
76 {
77 super(nameKey, abbreviationKey, unitSystem, referenceUnit, conversionFactorToReferenceUnit, true);
78 this.massUnit = referenceUnit.getMassUnit();
79 this.timeUnit = referenceUnit.getTimeUnit();
80 }
81
82
83
84
85 public final MassUnit getMassUnit()
86 {
87 return this.massUnit;
88 }
89
90
91
92
93 public final TimeUnit getTimeUnit()
94 {
95 return this.timeUnit;
96 }
97
98
99 @Override
100 public final FlowMassUnit getStandardUnit()
101 {
102 return KILOGRAM_PER_SECOND;
103 }
104
105
106 @Override
107 public final String getSICoefficientsString()
108 {
109 return "kg/s";
110 }
111
112 }