2 Copyright (c) 2000-2016 Ericsson Telecom AB
3 All rights reserved. This program and the accompanying materials
4 are made available under the terms of the Eclipse Public License v1.0
5 which accompanies this distribution, and is available at
6 http://www.eclipse.org/legal/epl-v10.html
17 <meta http-equiv=
"Content-Type" content=
"text/html; charset=utf-8">
18 <meta http-equiv=
"Content-Language" content=
"en-us">
19 <title>enumerated
</title>
21 <body bgcolor=
"#DAD3C5" vlink=
"#0094D2" link=
"#003258">
22 <table align=
"left" border=
"0" cellspacing=
"0" cellpadding=
"0" valign=top
>
24 <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>
27 <table border=
"0" align=
"right" cellpadding=
"0" cellspacing=
"0">
29 <td><a href=
"../titan_main.html" alt=
"contents"><img border=
"0" src=
"../images/ao.jpg" width=
"53" height=
"40"></a></td>
30 <td><a href=
"../titan_index.html" alt=
"index"><img border=
"0" src=
"../images/up.jpg" width=
"53" height=
"40"></a></td>
31 <td><a href=
"../info/enum2int.html" alt=
"previous"><img border=
"0" src=
"../images/left.jpg" width=
"53" height=
"40"></a></td>
32 <td><a href=
"../info/error.html" alt=
"next"><img border=
"0" src=
"../images/right.jpg" width=
"53" height=
"40"></a></td>
39 <hr align=
"left" width=
"75%">
40 <p>The keyword denotes a structured type which can take only a distinct named set of values. It cannot be parameterized.
42 <li>Enumerated types are never compatible with other basic or structured types.
</li>
43 <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,
44 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
46 <li>Operations on enumeration are restricted to assignment, equivalence and ordering operators
</li>
48 <p>Related keywords:
</p>
50 <li><a href=
"type.html"><font face=
"Courier New" color=
"#003258" size=
"4"><b>type
</b></font></a> </li>
51 <li><a href=
"address.html"><font face=
"Courier New" color=
"#003258" size=
"4"><b>address
</b></font></a></li>
53 <hr align=
"left" width=
"50%">
56 <table border=
"0" width=
"90%" bgcolor=
"#FFB599" cellpadding=
"4">
59 <h3 align=
"center"><font face=
"Courier New" color=
"#003258" size=
"5"><b>type enumerated
</b></font> (
<i>identifier
</i> |
<font face=
"Courier New" color=
"#003258" size=
"5"> <b>address
</b></font>)
<font
60 face=
"Courier New" color=
"#003258" size=
"5"><b>{
</b></font><br>
61 <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>]
[
<font
62 face=
"Courier New" color=
"#003258" size=
"5"><b>,
</b></font> <i>enumeration_identifier
</i> [
<font face=
"Courier New" color=
"#003258" size=
"5"><b>(
</b></font><i>integer
</i> <font
63 face=
"Courier New" color=
"#003258" size=
"5"><b>)
</b></font>]]
<font face=
"Courier New" color=
"#003258" size=
"5"><b>};
</b></font></h3>
71 <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>
74 <p><i>identifier
</i> is the
name used to refer to the enumeration. Must begin with a letter, may contain letters, numbers and underscore characters.
</p>
77 <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
78 System Under Test.
</p>
81 <p><i>enumeration_identifier
</i> identifies the elements of the enumeration. The identifiers must be unique within the same enumeration
</p>
84 <p><i>integer
</i> is the value optionally assigned to the enumeration element.
</p>
87 <hr align=
"left" width=
"50%">
89 <p><font face=
"Courier New">type enumerated Example {tisdag, fredag, onsdag};
</font>
90 <p>The enumeration called Example consists of three elements. The number
0 is assigned to the first one (tisdag), the number
1 to
"fredag
" and number
2 to the last element (onsdag).
</p>
92 <p><font face=
"Courier New">type enumerated Examplf {tisdag (
2), fredag (-
5), onsdag};
</font>
93 <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
94 optional integer value determines the value assigned to the element name. Thus,
"tisdag
" has the value
2,
"fredag
" the value -
5 and onsdag has been assigned the value zero. (The
95 first free value from
0 upwards is assigned to elements without the optional integer value.)
</p>
97 <p><font face=
"Courier New">type enumerated address {first_entity, second_entity};
</font>
98 <p>There are two entities in the system under test (SUT). We can refer to the first one using the element name
"first_entity
" whereas the other entity is addressed by the element name
99 "second_entity
".
</p>
100 <hr align=
"left" width=
"25%">
101 <p><a HREF=
"../info/BNF.html#enumdef">BNF definition
</a> of
<font face=
"Courier New"> enumerated
</font></p>