Creates a new group.
the group's unique name
The group's editor. Provides methods to add, remove and overwrite units.
The group's name. Has to be unique.
All units of the group arranged in a map.
The group's collection.
Returns a string array containing the short names of all units of this group.
a string array containing the short names of all units of this group.
Returns the group as human-readable string.
the group as string
Generated using TypeDoc
A group combines units of one quantity. Units of one group are convertible into each other. A group is always part of one single Collection. Groups can be edited through the Group.Editor. Like collections they can be modified in their entirety at runtime. Each group has a unique name (Group.name) that serves as an id.
As said all units of one group are convertible into each other. This works through the concept of "base units":
Every group has one single base unit. All other units of the group are defined in relation to this special unit. In this way, the library can figure out any conversion between any units of one group.
Example:
You create the group "length".
You want to implement the units "meter", "inch" and "yard". Now you have to decide on a unit that you want to be the base. You take "meter".
After that you have to define the other units in relation to your base unit. You know:
1 inch = 0.0254 meter
. So you set the ratio to0.0254
and the shift to0
.You know aswell:
1 yard = 0.9144 meter
. So you set the ratio to0.9144
and the shift to0
.The base unit's ratio is always
1
, its shift is always0
(because1 meter = 1 meter
).Now you finally have to add the units to your group. You can do that using the Group.Editor.
And you're done.