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 public class JerkUnit extends Unit<JerkUnit>
21 {
22
23 private static final long serialVersionUID = 20191003L;
24
25
26 public static final Quantity<JerkUnit> BASE = new Quantity<>("Jerk", "m/s3");
27
28
29 public static final JerkUnit SI =
30 new JerkUnit().build(new Unit.Builder<JerkUnit>().setQuantity(BASE).setId("m/s3").setName("meter per second cubed")
31 .setUnitSystem(UnitSystem.SI_DERIVED).setSiPrefixes(SIPrefixes.NONE, 1.0).setScale(IdentityScale.SCALE));
32
33
34 public static final JerkUnit M_PER_S3 = SI;
35
36
37 public static final JerkUnit CM_PER_S3 = SI.deriveLinear(factorLD("cm", "s"), "cm/s3", "centimeter per second cubed");
38
39
40 public static final JerkUnit MM_PER_S3 = SI.deriveLinear(factorLD("mm", "s"), "mm/s3", "millimeter per second cubed");
41
42
43 public static final JerkUnit FT_PER_S3 = SI.deriveLinear(factorLD("ft", "s"), "ft/s3", "foot per second cubed");
44
45
46 public static final JerkUnit IN_PER_S3 = SI.deriveLinear(factorLD("in", "s"), "in/s3", "inch per second cubed");
47
48
49
50
51
52
53
54 private static double factorLD(final String length, final String duration)
55 {
56 double l = LengthUnit.BASE.of(length).getScale().toStandardUnit(1.0);
57 double d = DurationUnit.BASE.of(duration).getScale().toStandardUnit(1.0);
58 return l / (d * d * d);
59 }
60 }