1 package org.djunits.unit;
2
3 import org.djunits.quantity.Quantity;
4 import org.djunits.unit.scale.IdentityScale;
5 import org.djunits.unit.si.SIPrefixes;
6 import org.djunits.unit.unitsystem.UnitSystem;
7
8
9
10
11
12
13
14
15
16 public class DurationUnit extends Unit<DurationUnit>
17 {
18
19 private static final long serialVersionUID = 20140607L;
20
21
22 public static final Quantity<DurationUnit> BASE = new Quantity<>("Duration", "s");
23
24
25 public static final DurationUnit SI = new DurationUnit().build(
26 new Unit.Builder<DurationUnit>().setQuantity(BASE).setId("s").setName("second").setUnitSystem(UnitSystem.SI_BASE)
27 .setSiPrefixes(SIPrefixes.UNIT, 1.0).setScale(IdentityScale.SCALE).setAdditionalAbbreviations("sec"));
28
29
30 public static final DurationUnit SECOND = SI;
31
32
33 public static final DurationUnit MICROSECOND =
34 SI.deriveLinear(1.0E-6, "mus", "microsecond", UnitSystem.SI_DERIVED, "\u03BCs", "mus", "\u03BCsec", "musec");
35
36
37 public static final DurationUnit MILLISECOND =
38 SI.deriveLinear(1.0E-3, "ms", "millisecond", UnitSystem.SI_DERIVED, "ms", "ms", "msec");
39
40
41 public static final DurationUnit MINUTE = SI.deriveLinear(60.0, "min", "minute", UnitSystem.SI_ACCEPTED, "min", "min");
42
43
44 public static final DurationUnit HOUR =
45 MINUTE.deriveLinear(60.0, "h", "hour", UnitSystem.SI_ACCEPTED, "h", "h", new String[] {"hr", "hour"});
46
47
48 public static final DurationUnit DAY = HOUR.deriveLinear(24.0, "day", "day", UnitSystem.SI_ACCEPTED, "day", "day");
49
50
51 public static final DurationUnit WEEK =
52 DAY.deriveLinear(7.0, "wk", "week", UnitSystem.OTHER, "wk", "wk", new String[] {"week"});
53
54 }