Sync with 5.4.0
[deliverable/titan.core.git] / help / info / enumerated.html
1 <!--
2 Copyright (c) 2000-2015 Ericsson Telecom AB
3
4 All rights reserved. This program and the accompanying materials
5 are made available under the terms of the Eclipse Public License v1.0
6 which accompanies this distribution, and is available at
7 http://www.eclipse.org/legal/epl-v10.html
8 -->
9 <html>
10 <head>
11 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
12 <meta http-equiv="Content-Language" content="en-us">
13 <title>enumerated</title>
14 </head>
15 <body bgcolor="#DAD3C5" vlink="#0094D2" link="#003258">
16 <table align="left" border="0" cellspacing="0" cellpadding="0" valign=top>
17 <tr>
18 <td width=105 height=40><a href="https://projects.eclipse.org/projects/tools.titan"><img src="../images/titan_transparent.gif" border=0 width=105 height=40 align="left" alt="Titan"></a></td>
19 </tr>
20 </table>
21 <table border="0" align="right" cellpadding="0" cellspacing="0">
22 <tr>
23 <td><a href="../titan_main.html" alt="contents"><img border="0" src="../images/ao.jpg" width="53" height="40"></a></td>
24 <td><a href="../titan_index.html" alt="index"><img border="0" src="../images/up.jpg" width="53" height="40"></a></td>
25 <td><a href="../info/encvalue.html" alt="previous"><img border="0" src="../images/left.jpg" width="53" height="40"></a></td>
26 <td><a href="../info/error.html" alt="next"><img border="0" src="../images/right.jpg" width="53" height="40"></a></td>
27 </tr>
28 </table>
29 <p><br clear="all">
30 </p>
31 <hr>
32 <h1>enumerated</h1>
33 <hr align="left" width="75%">
34 <p>The keyword denotes a structured type which can take only a distinct named set of values. It cannot be parameterized.&nbsp;
35 <ul>
36 <li>Enumerated types are never compatible with other basic or structured types.</li>
37 <li>For each enumeration without an assigned integer value, the system successively associates an integer number in the textual order of the enumerations, starting at the left-hand side,
38 beginning with zero, by step 1 and skipping any number occupied in any of the enumerations with a manually assigned value. These values are only used by the system to allow the use of relational
39 operators.</li>
40 <li>Operations on enumeration are restricted to assignment, equivalence and ordering operators</li>
41 </ul>
42 <p>Related keywords:</p>
43 <ul>
44 <li><a href="type.html"><font face="Courier New" color="#003258" size="4"><b>type</b></font></a> &nbsp;</li>
45 <li><a href="address.html"><font face="Courier New" color="#003258" size="4"><b>address</b></font></a></li>
46 </ul>
47 <hr align="left" width="50%">
48 <div align="center">
49 <center>
50 <table border="0" width="90%" bgcolor="#FFB599" cellpadding="4">
51 <tr>
52 <td width="100%">
53 <h3 align="center"><font face="Courier New" color="#003258" size="5"><b>type enumerated</b></font> (<i>identifier&nbsp;</i> |<font face="Courier New" color="#003258" size="5"> <b>address</b></font>)<font
54 face="Courier New" color="#003258" size="5"><b>{</b></font><br>
55 &nbsp; <i>enumeration_identifier</i> [<font face="Courier New" color="#003258" size="5"><b>(</b></font><i>integer</i> <font face="Courier New" color="#003258" size="5"><b>)</b></font>]&nbsp;[<font
56 face="Courier New" color="#003258" size="5"><b>,</b></font> <i>enumeration_identifier</i>&nbsp;[<font face="Courier New" color="#003258" size="5"><b>(</b></font><i>integer</i> <font
57 face="Courier New" color="#003258" size="5"><b>)</b></font>]] <font face="Courier New" color="#003258" size="5"><b>};</b></font></h3>
58 </td>
59 </tr>
60 </table>
61 </center>
62 </div>
63 <ul>
64 <li>
65 <p>The <a href="type.html"><font face="Courier New" color="#003258" size="4"><b>type</b></font></a> keyword introduces the type definition.</p>
66 </li>
67 <li>
68 <p><i>identifier</i> is the&nbsp;name used to refer to the enumeration. Must begin with a letter, may contain letters, numbers and underscore characters.</p>
69 </li>
70 <li>
71 <p><a href="address.html"><font face="Courier New" color="#003258" size="4"><b>address</b></font></a> is a user defined type to allow addressing specific entities inside the
72 System Under Test.</p>
73 </li>
74 <li>
75 <p><i>enumeration_identifier</i> identifies the elements of the enumeration. The identifiers must be unique within the same enumeration</p>
76 </li>
77 <li>
78 <p><i>integer</i> is the value optionally assigned to the enumeration element.</p>
79 </li>
80 </ul>
81 <hr align="left" width="50%">
82 <p>Example 1:
83 <p><font face="Courier New">type enumerated Example {tisdag, fredag, onsdag};</font>
84 <p>The enumeration called Example consists of three elements. The number 0 is assigned to the first one (tisdag), the number 1 to &quot;fredag&quot; and number 2 to the last element (onsdag).</p>
85 <p>Example 2:
86 <p><font face="Courier New">type enumerated Examplf {tisdag (2), fredag (-5), onsdag};</font>
87 <p>The enumeration called Examplf consists of three elements. Note, that the same element names may be used as in example 1 because they must be unique only within the same enumeration. The
88 optional integer value determines the value assigned to the element name. Thus, &quot;tisdag&quot; has the value 2, &quot;fredag&quot; the value -5 and onsdag has been assigned the value zero. (The
89 first free value from 0 upwards is assigned to elements without the optional integer value.)</p>
90 <p>Example 3:
91 <p><font face="Courier New">type enumerated address {first_entity, second_entity};</font>
92 <p>There are two entities in the system under test (SUT). We can refer to the first one using the element name &quot;first_entity&quot; whereas the other entity is addressed by the element name
93 &quot;second_entity&quot;.</p>
94 <hr align="left" width="25%">
95 <p><a HREF="../info/BNF.html#enumdef">BNF definition</a> of <font face="Courier New"> enumerated</font></p>
96 </body>
97 </html>
This page took 0.04052 seconds and 5 git commands to generate.