1 package org.djunits.demo.website;
2
3 import org.djunits.unit.DurationUnit;
4 import org.djunits.unit.LengthUnit;
5 import org.djunits.unit.Unit;
6 import org.djunits.unit.quantity.Quantity;
7 import org.djunits.unit.scale.IdentityScale;
8 import org.djunits.unit.si.SIPrefixes;
9 import org.djunits.unit.unitsystem.UnitSystem;
10
11
12
13
14
15
16
17
18
19
20
21 public class JerkUnit extends Unit<JerkUnit>
22 {
23
24 private static final long serialVersionUID = 20191003L;
25
26
27 public static final Quantity<JerkUnit> BASE = new Quantity<>("Jerk", "m/s3");
28
29
30 public static final JerkUnit SI =
31 new JerkUnit().build(new Unit.Builder<JerkUnit>().setQuantity(BASE).setId("m/s3").setName("meter per second cubed")
32 .setUnitSystem(UnitSystem.SI_DERIVED).setSiPrefixes(SIPrefixes.NONE, 1.0).setScale(IdentityScale.SCALE));
33
34
35 public static final JerkUnit M_PER_S3 = SI;
36
37
38 public static final JerkUnit CM_PER_S3 = SI.deriveLinear(factorLD("cm", "s"), "cm/s3", "centimeter per second cubed");
39
40
41 public static final JerkUnit MM_PER_S3 = SI.deriveLinear(factorLD("mm", "s"), "mm/s3", "millimeter per second cubed");
42
43
44 public static final JerkUnit FT_PER_S3 = SI.deriveLinear(factorLD("ft", "s"), "ft/s3", "foot per second cubed");
45
46
47 public static final JerkUnit IN_PER_S3 = SI.deriveLinear(factorLD("in", "s"), "in/s3", "inch per second cubed");
48
49
50
51
52
53
54
55 private static double factorLD(final String length, final String duration)
56 {
57 double l = LengthUnit.BASE.of(length).getScale().toStandardUnit(1.0);
58 double d = DurationUnit.BASE.of(duration).getScale().toStandardUnit(1.0);
59 return l / (d * d * d);
60 }
61 }