1 package org.djunits.unit;
2
3 import static org.djunits.unit.unitsystem.UnitSystem.CGS;
4 import static org.djunits.unit.unitsystem.UnitSystem.IMPERIAL;
5 import static org.djunits.unit.unitsystem.UnitSystem.MTS;
6 import static org.djunits.unit.unitsystem.UnitSystem.OTHER;
7 import static org.djunits.unit.unitsystem.UnitSystem.SI_DERIVED;
8
9 import org.djunits.unit.unitsystem.UnitSystem;
10
11
12
13
14
15
16
17
18
19
20
21 public class ForceUnit extends LinearUnit<ForceUnit>
22 {
23
24 private static final long serialVersionUID = 20140607L;
25
26
27 private final MassUnit massUnit;
28
29
30 private final LengthUnit lengthUnit;
31
32
33 private final DurationUnit durationUnit;
34
35
36 public static final ForceUnit SI;
37
38
39 public static final ForceUnit NEWTON;
40
41
42 public static final ForceUnit DYNE;
43
44
45 public static final ForceUnit KILOGRAM_FORCE;
46
47
48 public static final ForceUnit OUNCE_FORCE;
49
50
51 public static final ForceUnit POUND_FORCE;
52
53
54 public static final ForceUnit TON_FORCE;
55
56
57 public static final ForceUnit STHENE;
58
59 static
60 {
61 SI = new ForceUnit(MassUnit.KILOGRAM, LengthUnit.METER, DurationUnit.SECOND, "ForceUnit.newton", "ForceUnit.N",
62 SI_DERIVED, true);
63 NEWTON = SI;
64 DYNE = new ForceUnit(MassUnit.GRAM, LengthUnit.CENTIMETER, DurationUnit.SECOND, "ForceUnit.dyne", "ForceUnit.dyn", CGS,
65 true);
66 KILOGRAM_FORCE = new ForceUnit(MassUnit.KILOGRAM, AccelerationUnit.STANDARD_GRAVITY, "ForceUnit.kilogram-force",
67 "ForceUnit.kgf", OTHER, true);
68 OUNCE_FORCE = new ForceUnit(MassUnit.OUNCE, AccelerationUnit.STANDARD_GRAVITY, "ForceUnit.ounce-force", "ForceUnit.ozf",
69 IMPERIAL, true);
70 POUND_FORCE = new ForceUnit(MassUnit.POUND, AccelerationUnit.STANDARD_GRAVITY, "ForceUnit.pound-force", "ForceUnit.lbf",
71 IMPERIAL, true);
72 TON_FORCE = new ForceUnit(MassUnit.TON_SHORT, AccelerationUnit.STANDARD_GRAVITY, "ForceUnit.ton-force", "ForceUnit.tnf",
73 IMPERIAL, true);
74 STHENE = new ForceUnit(MassUnit.TON_METRIC, AccelerationUnit.METER_PER_SECOND_2, "ForceUnit.sthene", "ForceUnit.sn",
75 MTS, true);
76 }
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91 private ForceUnit(final MassUnit massUnit, final LengthUnit lengthUnit, final DurationUnit durationUnit,
92 final String nameOrNameKey, final String abbreviationOrAbbreviationKey, final UnitSystem unitSystem,
93 final boolean standardUnit)
94 {
95 super(nameOrNameKey, abbreviationOrAbbreviationKey, unitSystem, NEWTON, massUnit.getScaleFactor()
96 * lengthUnit.getScaleFactor() / (durationUnit.getScaleFactor() * durationUnit.getScaleFactor()), standardUnit);
97 this.massUnit = massUnit;
98 this.lengthUnit = lengthUnit;
99 this.durationUnit = durationUnit;
100 }
101
102
103
104
105
106
107
108
109
110
111 public ForceUnit(final MassUnit massUnit, final LengthUnit lengthUnit, final DurationUnit durationUnit, final String name,
112 final String abbreviation, final UnitSystem unitSystem)
113 {
114 this(massUnit, lengthUnit, durationUnit, name, abbreviation, unitSystem, false);
115 }
116
117
118
119
120
121
122
123
124
125
126
127
128
129 private ForceUnit(final MassUnit massUnit, final AccelerationUnit accelerationUnit, final String nameOrNameKey,
130 final String abbreviationOrAbbreviationKey, final UnitSystem unitSystem, final boolean standardUnit)
131 {
132 super(nameOrNameKey, abbreviationOrAbbreviationKey, unitSystem, NEWTON,
133 massUnit.getScaleFactor() * accelerationUnit.getScaleFactor(), standardUnit);
134 this.massUnit = massUnit;
135 this.lengthUnit = accelerationUnit.getLengthUnit();
136 this.durationUnit = accelerationUnit.getDurationUnit();
137 }
138
139
140
141
142
143
144
145
146
147 public ForceUnit(final MassUnit massUnit, final AccelerationUnit accelerationUnit, final String name,
148 final String abbreviation, final UnitSystem unitSystem)
149 {
150 this(massUnit, accelerationUnit, name, abbreviation, unitSystem, false);
151 }
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166 private ForceUnit(final String nameOrNameKey, final String abbreviationOrAbbreviationKey, final UnitSystem unitSystem,
167 final ForceUnit referenceUnit, final double scaleFactorToReferenceUnit, final boolean standardUnit)
168 {
169 super(nameOrNameKey, abbreviationOrAbbreviationKey, unitSystem, referenceUnit, scaleFactorToReferenceUnit,
170 standardUnit);
171 this.massUnit = referenceUnit.getMassUnit();
172 this.lengthUnit = referenceUnit.getLengthUnit();
173 this.durationUnit = referenceUnit.getDurationUnit();
174 }
175
176
177
178
179
180
181
182
183
184
185 public ForceUnit(final String name, final String abbreviation, final UnitSystem unitSystem, final ForceUnit referenceUnit,
186 final double scaleFactorToReferenceUnit)
187 {
188 this(name, abbreviation, unitSystem, referenceUnit, scaleFactorToReferenceUnit, false);
189 }
190
191
192
193
194 public final MassUnit getMassUnit()
195 {
196 return this.massUnit;
197 }
198
199
200
201
202 public final LengthUnit getLengthUnit()
203 {
204 return this.lengthUnit;
205 }
206
207
208
209
210 public final DurationUnit getDurationUnit()
211 {
212 return this.durationUnit;
213 }
214
215
216 @Override
217 public final ForceUnit getStandardUnit()
218 {
219 return NEWTON;
220 }
221
222
223 @Override
224 public final String getSICoefficientsString()
225 {
226 return "kgm/s2";
227 }
228
229 }