OTX Reference  
OpenTestSystem.Otx.Extensions.DataType.DataTypes.Enumeration Class Reference

Enumeration is an otx:SimpleType More...

Inheritance diagram for OpenTestSystem.Otx.Extensions.DataType.DataTypes.Enumeration:
Inheritance graph

Public Attributes

OtxLink enumerationType
 Cardinality [1]
Refers to a certain EnumerationSignature. More...
 
OtxName init
 Cardinality [0..1]
Element name of the related enumeration. If not specified, the first enumeration element shall be used as initial value. More...
 

Detailed Description

Enumeration is an otx:SimpleType

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.

Note
IMPORTANT - If the OTX Core conversion term otx:ToString is applied to an Enumeration term, the element name shall be returned.
IMPORTANT - If the OTX Core conversion term otx:ToInteger is applied to an Enumeration term, the Integer value shall be returned.
IMPORTANT - An Enumeration value can be persisted, see OTX Persistence extension.


Literal
Enumeration values are named constants. Therefore the EnumerationLiteral term will return a reference to the value of the constant that has the name provided in the EnumerationLiteral's elementName field.

EnumerationSignature1.EnumerationElement1



Conversion terms
The following table shows the rules for conversion to another data type:

ConversionResultSample
ToBooleanUndefined (should not be used)
ToIntegerReturns the integer value of the enumeration termInteger n = ToInteger(enumerationSignatureVariable); // Returns 12 (supposed the current enumeration element's value is 12)
ToFloatUndefined (should not be used)
ToStringReturns the name of current enumeration elementString s = ToString(enumerationSignatureVariable); // Returns "EnumerationElement1"
ToByteFieldUndefined (should not be used)
Checker rules
Core.CheckerRule.Core_Chk053 – no dangling OtxLink associations
CheckerRule.DataType_Chk002 - Correct target for Enumeration

Sample
package DataType.EnumerationSignature EnumerationSignature1(Integer EnumerationElement1 = 3, Integer EnumerationElement2 = 5, Integer EnumerationElement3 = 7, Integer EnumerationElement4 = 9);
// Global Declarations
public procedure main()
{
// Local Declarations
EnumerationSignature1 Enumeration1 = EnumerationSignature1.EnumerationElement1;
}

Member Data Documentation

◆ enumerationType

OtxLink OpenTestSystem.Otx.Extensions.DataType.DataTypes.Enumeration.enumerationType

Cardinality [1]
Refers to a certain EnumerationSignature.

◆ init

OtxName OpenTestSystem.Otx.Extensions.DataType.DataTypes.Enumeration.init

Cardinality [0..1]
Element name of the related enumeration. If not specified, the first enumeration element shall be used as initial value.