Distance
,Angle
, and Current
.
Why?
Angle
where a Distance
is
expected)Distance
Angle
(-inf, inf)
, wrapping [0, 0.5)
, and relative [-0.5, 0.5)
.Current
Unit<U: Unit<U>>
Unit
is an interface, which means its easy to subclass it, and implement it in enums.
We use Unit
to define families of units.
i.e. Dairy has DistanceUnit
and AngleUnit
as families for Distance
and
Angle
respectively.
Unit
is used to define some common maths to enable conversion between
different units in the same family, and makes it easy to define your own units
in pre-existing families.
ReifiedUnit<U: Unit<U>, RU: ReifiedUnit<U, RU>>
Unit
was our concept of a unit, then ReifiedUnit
is an actual value,
measured by our Unit
.
This is a combination of a value, and a specific unit in a unit family.
i.e. Distance
extends ReifiedUnit<DistanceUnit, Distance>
So 10 mm
is a Distance
!
It has:
value
of 10unit
of millimeters
ReifiedUnit
is what we’ll work with most, and so the remainder of this page
will look at Distance
and Angle