OTX Reference  
OpenTestSystem.Otx.Core.DataTypes.Map Class Reference

Dictionary of key/value pairs. More...

Inheritance diagram for OpenTestSystem.Otx.Core.DataTypes.Map:
Inheritance graph

Public Attributes

MapLiteral init
 Initialisation of a Map declaration More...
 
CountableType keyType
 Data type of the Map keys More...
 
DataType valueType
 Data type of the Map values More...
 

Detailed Description

Dictionary of key/value pairs.

An OTX Map contains of an arbitrary number of key/value pair items. At the declaration the map’s key and value data types must be defined. Map keys must be of countable type. All keys must be unique inside a map, because values in a map are accessed by their key. For the data type of the values, there are no restrictions other than that all values in a map must be of the same type.

Note
If a Map declaration is not explicitly initialized, an empty Map will be created and assigned to the Map.
IMPORTANT - The order in which the elements of a Map are returned is not defined!
Terms and Actions
List of some useful terms and actions:
Conversion Terms
ConversionResultSample
ToBooleanUndefined, do not use it!
ToIntegerUndefined, do not use it!
ToFloatUndefined, do not use it!
ToStringReturns the Map as a String
String s = ToString({ 1:true, 2:false, 3:true }); // Returns "{ 1:true, 2:false, 3:true }"
ToByteFieldUndefined, do not use it!
Syntax Declaration
Map<KeyType, ValueType> Declaration [= MapLiteral];
Literal
{ key1:value1, key2:value2, ... }
Sample
Map<Integer, Boolean> MapVariable = { 1:true, 2:false, 3:true };
See also
DataTypes.List

Member Data Documentation

◆ init

MapLiteral OpenTestSystem.Otx.Core.DataTypes.Map.init

Initialisation of a Map declaration

This optional element stands for the initialisation of the Map at declaration time. Initialisation is done by using a recursive mechanism: E.g. A Map of Maps of Integer keys and Integer values is initialised by using Map literals for each Map key/value pair item again, and so on.

Sample
Map<Integer, Integer> MapVariable1 = { 1:0, 4:0, 2:1 };
Map<String, String> MapVariable2 = { "key1":"Hello", "key2":"World" };
Map<Integer, Map<Integer, String>> MapVariable3 = { 1:{ 1:"Hello", 2:"World" }, 6:{ 0:"Value1", 1:"Value2", 2:"Value3" } };

◆ keyType

CountableType OpenTestSystem.Otx.Core.DataTypes.Map.keyType

Data type of the Map keys

◆ valueType

DataType OpenTestSystem.Otx.Core.DataTypes.Map.valueType

Data type of the Map values