| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
on |
| 15 |
|
| 16 |
<html> |
| 17 |
<head> |
| 18 |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
| 19 |
<meta http-equiv="Content-Language" content="en-us"> |
| 20 |
<title>subset</title> |
| 21 |
</head> |
| 22 |
<body bgcolor="#DAD3C5" vlink="#0094D2" link="#003258"> |
| 23 |
<table align="left" border="0" cellspacing="0" cellpadding="0" valign=top> |
| 24 |
<tr> |
| 25 |
<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> |
| 26 |
</tr> |
| 27 |
</table> |
| 28 |
<table border="0" align="right" cellpadding="0" cellspacing="0"> |
| 29 |
<tr> |
| 30 |
<td><a href="../titan_main.html" alt="contents"><img border="0" src="../images/ao.jpg" width="53" height="40"></a></td> |
| 31 |
<td><a href="../titan_index.html" alt="index"><img border="0" src="../images/up.jpg" width="53" height="40"></a></td> |
| 32 |
<td><a href="str2oct.html" alt="previous"><img border="0" src="../images/left.jpg" width="53" height="40"></a></td> |
| 33 |
<td><a href="substr.html" alt="next"><img border="0" src="../images/right.jpg" width="53" height="40"></a></td> |
| 34 |
</tr> |
| 35 |
</table> |
| 36 |
<p><br clear="all"> |
| 37 |
</p> |
| 38 |
<hr> |
| 39 |
<h1>subset</h1> |
| 40 |
<hr align="left" width="75%"> |
| 41 |
<p>The keyword is only used in conjunction with <font face="Courier New"><b>template</b></font> definition. It denotes the matching mechanism where the incoming field <a |
| 42 |
href="template.html#subset">may contain only</a> elements defined in the value list of subset, and may contain less. It is applicable to fields <font face="Courier New" size="4"><b>set</b></font> <font |
| 43 |
face="Courier New" size="4"><b>of</b></font> types only. |
| 44 |
<hr align="left" width="50%"> |
| 45 |
<p>Related keyword:</p> |
| 46 |
<ul> |
| 47 |
<li><a href="template.html"><b><font face="Courier New" color="#003258" size="4">template</font></b></a></li> |
| 48 |
</ul> |
| 49 |
<hr align="left" width="50%"> |
| 50 |
<div align="center"> |
| 51 |
<center> |
| 52 |
<table border="0" width="90%" bgcolor="#FFB599" cellpadding="4"> |
| 53 |
<tr> |
| 54 |
<td width="100%"> |
| 55 |
<h3 align="center"><font face="Courier New" color="#003258" size="5"><b>subset(</b></font><i>value_list</i><font face="Courier New" color="#003258" size="5"><b>)</b></font></h3> |
| 56 |
</td> |
| 57 |
</tr> |
| 58 |
</table> |
| 59 |
</center> |
| 60 |
</div> |
| 61 |
<ul> |
| 62 |
<li> |
| 63 |
<p><i>value_list</i> is a comma separated list containing all the values that are permitted for the concerned field. The field must not contain elements not included in the list.</p> |
| 64 |
</li> |
| 65 |
</ul> |
| 66 |
<hr align="left" width="50%"> |
| 67 |
<p><a name="Example 1">Example 1</a> |
| 68 |
<font face="Courier New"> |
| 69 |
<p>type set of integer MySetOfType (0 .. 10); |
| 70 |
<p>template MySetOfType MyTemplate1 := subset (1, 2, 3); |
| 71 |
</font> |
| 72 |
<p>matches any sequence of integers which contains zero or one occurrences of the numbers 1, 2 and 3 in any order and position </p> |
| 73 |
<p><a name="Example 2">Example 2</a> |
| 74 |
<font face="Courier New"> |
| 75 |
<p>template MySetOfType MyTemplate2 := subset (1, 2, ?); |
| 76 |
</font> |
| 77 |
<p>matches any sequence of integers which contains zero or one occurrences of the numbers 1, 2 and a valid integer value (i.e. between 0 and 10, inclusive) in any order and position </p> |
| 78 |
<p><a name="Example 3">Example 3</a> |
| 79 |
<font face="Courier New"> |
| 80 |
<p>type record of integer RoI; |
| 81 |
<p>type set of integer SoI; |
| 82 |
<p>template RoI t_RoI1 := {1, 2, ?}; |
| 83 |
<p>template SoI t_SoI1 := subset(all from t_RoI1); |
| 84 |
</font> |
| 85 |
<p>Results in subset(1, 2, ?).</p> |
| 86 |
<hr align="left" width="50%"> |
| 87 |
<p><a HREF="BNF.html#subsetmatch">BNF definition</a> of <font face="Courier New">subset</font></p> |
| 88 |
</body> |
| 89 |
</html> |