Difference between revisions of "Core.Terms.MapCreate"

From emotive
Jump to navigation Jump to search
(Created page with "Category:Core == Classification == {{ClassificationActivity | MapCreate | Creates a new object of type map at run time | Term | OTX Core library | Creation...")
 
 
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
[[Category:Core]]
+
{{DISPLAYTITLE:OTX '''MapCreate'''}}[[Category:Core]]
 
== Classification ==
 
== Classification ==
{{ClassificationActivity | MapCreate | Creates a new object of type map at run time | [[Term]] | [[Core|OTX Core library]] | [[Creation terms]] | [[OutOfBoundsException]] | [[CoreChk044|Core_Chk044]]<br/>[[CoreChk045|Core_Chk045]]}}
+
{{ClassificationActivity | MapCreate | Creates a new object of type map at run time | [[Term]] | [[Core|OTX Core library]] | [[Creation terms]] | [[Core.Actions.Throw.Exception.OutOfBoundsException|OutOfBoundsException]] | [[Core.Validation.CoreChk044|Core_Chk044]]<br/>[[Core.Validation.CoreChk045|Core_Chk045]]}}
  
== Pseudo-Code Syntax ==
+
== OTL Syntax ==
 
<syntaxhighlight lang="java" enclose="div" style="font-size: medium;">
 
<syntaxhighlight lang="java" enclose="div" style="font-size: medium;">
Map MapCreate(DataType keyType, DataType itemType, Map items);
+
MapTerm = MapCreate(CountableDataType, DataType, {CountableTerm1:Term1, CountableTerm2:Term2, ...});
 
</syntaxhighlight>
 
</syntaxhighlight>
  
Line 11: Line 11:
 
'''MapCreate''' is a term to create a new map at run time. It is produced by passing a set of key/value pairs.
 
'''MapCreate''' is a term to create a new map at run time. It is produced by passing a set of key/value pairs.
  
{{TermReturnValue| [[Map]] | The newly created map}}
+
{{TermReturnValue| [[Core.DataTypes.ComplexDataType.ContainerDataType.Map|Map]] | The newly created map}}
  
 
== Properties ==
 
== Properties ==
Line 21: Line 21:
 
|}
 
|}
  
== Examples ==
+
== OTL Examples ==
 
<syntaxhighlight lang="java" enclose="div" style="font-size: medium;">
 
<syntaxhighlight lang="java" enclose="div" style="font-size: medium;">
Map<Integer,String> result = MapCreate(Integer, String, 1, "text1", 2, "text2");
+
Map<Integer,String> result;
 +
result = MapCreate(Integer, String, {1:"text1", 2:"text2"});
 
//Returns the result = {{1, "text1"}, {2, "text2"}}
 
//Returns the result = {{1, "text1"}, {2, "text2"}}
 
</syntaxhighlight>
 
</syntaxhighlight>
  
 
== See also ==
 
== See also ==
[[ListCreate]] <br/>
+
[[Core.Terms.ListCreate|ListCreate]] <br/>
[[UserExceptionCreate]]
+
[[Core.Terms.UserExceptionCreate|UserExceptionCreate]]

Latest revision as of 08:45, 16 February 2016

Classification

Name MapCreate
Short Description Creates a new object of type map at run time
Class Term
Extension OTX Core library
Group Creation terms
Exceptions OutOfBoundsException
Checker Rules Core_Chk044
Core_Chk045
Standard Compliant Yes

OTL Syntax

MapTerm = MapCreate(CountableDataType, DataType, {CountableTerm1:Term1, CountableTerm2:Term2, ...});

Description

MapCreate is a term to create a new map at run time. It is produced by passing a set of key/value pairs.

Return Value

The Term returns the value, see table below.

Icons Note.png In OTX, Terms are categorized according to its return data type!
Data Type Description
Map The newly created map

Properties

Name Data Type Class Default Cardinality Description
KeyType DataType Name - [1] Data type of the keys
ItemType DataType Name - [1] Data type of the values
MapItems - Term - [1] List of one or more key/value pairs of the respective type. No elements are specified, an empty map is generated.

OTL Examples

Map<Integer,String> result;
result = MapCreate(Integer, String, {1:"text1", 2:"text2"});
//Returns the result = {{1, "text1"}, {2, "text2"}}

See also

ListCreate
UserExceptionCreate