UNIT Object
- Last UpdatedNov 07, 2024
- 2 minute read
Member
|
Name |
Result |
Purpose |
|---|---|---|
|
Constructors |
||
|
Unit() |
||
|
Unit(REAL) |
UNIT |
Creates a UNIT of which the value of REAL is a (valid) enum value, or is a negative (compound) unit. |
|
Unit(STRING) |
UNIT |
Creates a UNIT with String equivalent to (in order) Description, Name, ComponentName, or Hashcode. |
Methods
|
Name |
Result |
Purpose |
|---|---|---|
|
Name String Methods |
||
|
Description() String() |
STRING |
Long description of unit, often same as Name(). |
|
Name() |
STRING |
Unit name used as qualifier for solitary units. |
|
ShortName() |
STRING |
Short name used as qualifier for component units, often same as Name(). |
|
Hashcode()Ptype() |
STRING |
Hash code of unit. If a compound unit returns 'COMPOUND', if derived from component standard units (for example, Area units are Distance squared), returns 'DRVD'. |
|
General Queries |
||
|
Enum() |
REAL |
Unique integer ID for this unit. Positive if standard unit. Negative if compound unit. |
|
Factor() |
REAL |
Conversion factor to database units. |
|
UnitQualifier() |
STRING |
Unit qualifier of current units. |
|
Dimension() |
MEASURE |
Dimension of unit. |
|
IsStandard() |
BOOLEAN |
TRUE if a standard, single unit. FALSE if a compound unit (for example, kg/m3, m2). |
|
IsNull() |
BOOLEAN |
TRUE if units are NONE. |
|
AllDimensions() |
ARRAY of MEASURES |
Set of all standard dimensions. |
|
AllUnits() |
ARRAY of UNITS |
Set of all named, standard Units. |
|
IsImperial() |
BOOLEAN |
TRUE if an exclusively imperial unit (inch, lb) or a non-specific unit (second, ohm, degree). |
|
IsMetric() |
BOOLEAN |
TRUE if an exclusively metric unit (mm, kg) or a non-specific unit used in metric situations. |
Note:
Derived units (which are units derived from current units of component dimensions
such as area units derived from current distance) and numeric units (no conversion
or unit qualifiers) have empty strings for name, description and qualifier.
However, their hash codes are DRVD and NUMB so they can be created using a form as object unit ('DRVD'). Current units can be set to this using 'measure.setUnits'.
Additionally, numeric current units can be set using 'measure.numeric()'.