Difference between revisions of "Extensions.Quantities.Unit"
Jump to navigation
Jump to search
(Created page with "{{DISPLAYTITLE:Data Type '''Unit'''}}Category:DataTypeCategory:Quantities == Classification == {{ClassificationDataType | Unit | A physical unit which is defined in a...") |
|||
(9 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
{{DISPLAYTITLE:Data Type '''Unit'''}}[[Category:DataType]][[Category:Quantities]] | {{DISPLAYTITLE:Data Type '''Unit'''}}[[Category:DataType]][[Category:Quantities]] | ||
== Classification == | == Classification == | ||
− | {{ClassificationDataType | Unit | A physical unit which is defined in a UNIT-SPEC. | [[ | + | {{ClassificationDataType | Unit | A physical unit which is defined in a UNIT-SPEC. | [[Core.DataTypes.SimpleDataType|Simple Data Type]] | [[Core.DataTypes.SimpleDataType.SimpleType|SimpleType]] | DefaultValue=A dimensionless unit. | Literal=Yes }} |
== Description == | == Description == | ||
Line 7: | Line 7: | ||
==Literal== | ==Literal== | ||
− | The syntax for [[Literals| Literals for complex data types]] | + | The syntax for [[Literals| Literals for complex data types]] will be used, '''UnitLiteral''' be used to create a '''Unit''' object based on a unit definition contained in UNIT-SPEC document. |
<syntaxhighlight lang="java" enclose="div" style="font-size: medium;"> | <syntaxhighlight lang="java" enclose="div" style="font-size: medium;"> | ||
Line 14: | Line 14: | ||
{{ConversionTable | | {{ConversionTable | | ||
− | String=Returns the | + | String=Returns the DISPLAY-NAME of the corresponding unit definition. | StringSample=<tt>String s = ToString([@Unit, "BL_DataLibraMIB.odx", "km"]); // Returns "km"</tt> |
}} | }} | ||
==Sample== | ==Sample== | ||
<syntaxhighlight lang="java" enclose="div" style="font-size: medium;"> | <syntaxhighlight lang="java" enclose="div" style="font-size: medium;"> | ||
− | Unit | + | Quantities.Unit UnitVariable = [@Unit, "BL_DataLibraMIB.odx", "km"]; |
</syntaxhighlight> | </syntaxhighlight> |
Latest revision as of 03:16, 13 September 2019
Classification
Name | Unit |
Short Description | A physical unit which is defined in a UNIT-SPEC. |
Class | Simple Data Type |
Base Data Type | SimpleType |
Default Value | A dimensionless unit. |
Provide a Literal | Yes |
SpecifiedBy | ISO 13209-3 |
Standard Compliant | Yes |
Description
A Unit represents a physical unit which is defined in a UNIT-SPEC. A Unit can be associated to a physical value when creating a Quantity, but it can also be used stand-alone, e.g. when comparing the display Unit of a Quantity to another Unit object.
Literal
The syntax for Literals for complex data types will be used, UnitLiteral be used to create a Unit object based on a unit definition contained in UNIT-SPEC document.
Value = Literal
Core Conversion
The following table shows the rules for conversion to another data type:
Conversion | Result | Sample |
ToBoolean | Undefined (should not be used) | |
ToInteger | Undefined (should not be used) | |
ToFloat | Undefined (should not be used) | |
ToString | Returns the DISPLAY-NAME of the corresponding unit definition. | String s = ToString([@Unit, "BL_DataLibraMIB.odx", "km"]); // Returns "km" |
ToByteField | Undefined (should not be used) |
Sample
Quantities.Unit UnitVariable = [@Unit, "BL_DataLibraMIB.odx", "km"];