Difference between revisions of "Extensions.DataType.Enumeration"
(Edited by Ngoc Tran.) |
|||
Line 6: | Line 6: | ||
The '''Enumeration''' type of the OTX '''DataType''' extension allows the OTX authors to define their own customized enumerations. To define the structure of the Enumeration the [[Extensions.DataType.EnumerationSignature|EnumerationSignature]] is used. An '''Enumeration''' consists of a set of named constants called enumeration elements. Each enumeration element assigns a unique name to a unique IntergerLiteral, so that the name can be used as an EnumerationLiteral inside OTX instead of the integer value. The simple term of the enumerator value is its integer value. Thus, for relational terms, the integer values of the specific enumerator value are used. | The '''Enumeration''' type of the OTX '''DataType''' extension allows the OTX authors to define their own customized enumerations. To define the structure of the Enumeration the [[Extensions.DataType.EnumerationSignature|EnumerationSignature]] is used. An '''Enumeration''' consists of a set of named constants called enumeration elements. Each enumeration element assigns a unique name to a unique IntergerLiteral, so that the name can be used as an EnumerationLiteral inside OTX instead of the integer value. The simple term of the enumerator value is its integer value. Thus, for relational terms, the integer values of the specific enumerator value are used. | ||
+ | |||
+ | ==Literal== | ||
+ | The syntax for [[Literals| Literals for complex data types]] will be used, where the '''member value''' is one of the values in the list. | ||
+ | |||
+ | <syntaxhighlight lang="java" enclose="div" style="font-size: medium;"> | ||
+ | @MessageType:INFO|WARNING|ERROR|YESNO_QUESTION|YESNOCANCEL_QUESTION | ||
+ | </syntaxhighlight> | ||
{{ConversionTable | | {{ConversionTable | |
Revision as of 06:45, 1 October 2019
Classification
Name | Enumeration |
Short Description | User-defined enumeration |
Class | Simple Data Type |
Base Data Type | SimpleType |
Default Value | The first enumeration element |
Provide a Literal | Yes |
SpecifiedBy | ISO 13209-3 |
Standard Compliant | Yes |
Description
The Enumeration type of the OTX DataType extension allows the OTX authors to define their own customized enumerations. To define the structure of the Enumeration the EnumerationSignature is used. An Enumeration consists of a set of named constants called enumeration elements. Each enumeration element assigns a unique name to a unique IntergerLiteral, so that the name can be used as an EnumerationLiteral inside OTX instead of the integer value. The simple term of the enumerator value is its integer value. Thus, for relational terms, the integer values of the specific enumerator value are used.
Literal
The syntax for Literals for complex data types will be used, where the member value is one of the values in the list.
@MessageType:INFO|WARNING|ERROR|YESNO_QUESTION|YESNOCANCEL_QUESTION
Core Conversion
The following table shows the rules for conversion to another data type:
Conversion | Result | Sample |
ToBoolean | Undefined (should not be used) | |
ToInteger | Returns the integer value of the enumeration term | Integer n = ToInteger(enumerationSignatureVariable); // Returns 12 (supposed the current enumeration element's value is 12) |
ToFloat | Undefined (should not be used) | |
ToString | Returns the name of current enumeration element | String s = ToString(enumerationSignatureVariable); // Returns "EnumerationElement1" |
ToByteField | Undefined (should not be used) |