1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241
|
<!--
Copyright (c) 2000-2021 Ericsson Telecom AB
All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Public License v2.0
which accompanies this distribution, and is available at
https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html
Contributors:
Baji, Laszlo
Balasko, Jeno
Gecse, Roland
Szabados, Kristof
Szabo, Janos Zoltan – initial implementation
-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Content-Language" content="en-us">
<title>operators</title>
</head>
<body bgcolor="#DAD3C5" vlink="#0094D2" link="#003258">
<table align="left" border="0" cellspacing="0" cellpadding="0" valign=top>
<tr>
<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>
</tr>
</table>
<table border="0" align="right" cellpadding="0" cellspacing="0">
<tr>
<td><a href="../titan_main.html" alt="contents"><img border="0" src="../images/ao.jpg" width="53" height="40"></a></td>
<td><a href="../titan_index.html" alt="index"><img border="0" src="../images/up.jpg" width="53" height="40"></a></td>
<td><a href="on.html" alt="previous"><img border="0" src="../images/left.jpg" width="53" height="40"></a></td>
<td><a href="optional.html" alt="next"><img border="0" src="../images/right.jpg" width="53" height="40"></a></td>
</tr>
</table>
<p><br clear="all">
</p>
<hr>
<h1>TTCN-3 operators</h1>
<hr align="left" width="75%">
<p>TTCN-3 supports a number of predefined operators that may be used in the terms of TTCN-3 expressions. The predefined operators fall into seven categories:
<ol>
<li>arithmetic operators;
<li>string operators;
<li>relational operators;
<li>logical operators;
<li>bitwise operators;
<li>shift operators;
<li>rotate operators.
</ol>
<p>These operators are listed in the following table:
<table border=1>
<tr>
<th>Category</th>
<th>Operator</th>
<th>Symbol or Keyword</th>
</tr>
<tr>
<td rowspan=6>Arithmetic operators</td>
<td>addition</td>
<td>+</td>
</tr>
<tr>
<td>substraction</td>
<td>-</td>
</tr>
<tr>
<td>multiplication</td>
<td>*</td>
</tr>
<tr>
<td>division</td>
<td>/</td>
</tr>
<tr>
<td>modulo</td>
<td><a href="mod.html">mod</a></td>
</tr>
<tr>
<td>remainder</td>
<td><a href="rem.html">rem</a></td>
</tr>
<tr>
<td>String operators</td>
<td>concatenation</td>
<td>&</td>
</tr>
<tr>
<td rowspan=6>Relational operators</td>
<td>equal</td>
<td>==</td>
</tr>
<tr>
<td>less than</td>
<td><</td>
</tr>
<tr>
<td>greater than</td>
<td>></td>
</tr>
<tr>
<td>not equal</td>
<td>!=</td>
</tr>
<tr>
<td>greater than or equal</td>
<td>>=</td>
</tr>
<tr>
<td>less than or equal</td>
<td><=</td>
</tr>
<tr>
<td rowspan=4>Logical operators</td>
<td>logical not</td>
<td><a href="not.html">not</a></td>
</tr>
<tr>
<td>logical and</td>
<td><a href="and.html">and</a></td>
</tr>
<tr>
<td>logical or</td>
<td><a href="or.html">or</a></td>
</tr>
<tr>
<td>logical xor</td>
<td><a href="xor.html">xor</a></td>
</tr>
<tr>
<td rowspan=4>Bitwise operators</td>
<td>bitwise not</td>
<td><a href="not4b.html">not4b</a></td>
</tr>
<tr>
<td>bitwise and</td>
<td><a href="and4b.html">and4b</a></td>
</tr>
<tr>
<td>bitwise or</td>
<td><a href="or4b.html">or4b</a></td>
</tr>
<tr>
<td>bitwise xor</td>
<td><a href="xor4b.html">xor4b</a></td>
</tr>
<tr>
<td rowspan=2>Shift operators</td>
<td>shift left</td>
<td><<</td>
</tr>
<tr>
<td>shift right</td>
<td>>></td>
</tr>
<tr>
<td rowspan=2>Rotate operators</td>
<td>rotate left</td>
<td><@</td>
</tr>
<tr>
<td>rotate right</td>
<td>@></td>
</tr>
</table>
<p>The precedence of these operators is shown in the table below. Within any row in this table, the listed operators have equal precedence. If more than one operator of equal precedence appears in
an expression, the operations are evaluated from left to right. Parentheses may be used to group operands in expressions, in which case a parenthesized expression has the highest precedence for
evaluation.
<table border=1>
<tr>
<th>Priority</th>
<th>Operator type</th>
<th>Operator</th>
</tr>
<tr>
<td>highest</td>
<td></td>
<td>( ... )</td>
</tr>
<tr>
<td rowspan=13></td>
<td>Unary</td>
<td>+, -</td>
</tr>
<tr>
<td>Binary</td>
<td>*, /, <a href="mod.html">mod</a>, <a href="and.html">rem</a></td>
</tr>
<tr>
<td>Binary</td>
<td>+, -, &</td>
</tr>
<tr>
<td>Unary</td>
<td><a href="not4b.html">not4b</a></td>
</tr>
<tr>
<td>Binary</td>
<td><a href="and4b.html">and4b</a></td>
</tr>
<tr>
<td>Binary</td>
<td><a href="xor4b.html">xor4b</a></td>
</tr>
<tr>
<td>Binary</td>
<td><a href="or4b.html">or4b</a></td>
</tr>
<tr>
<td>Binary</td>
<td><<, >>, <@, @></td>
</tr>
<tr>
<td>Binary</td>
<td><, >, <=, >=</td>
</tr>
<tr>
<td>Binary</td>
<td>==, !=</td>
</tr>
<tr>
<td>Unary</td>
<td><a href="not.html">not</a></td>
</tr>
<tr>
<td>Binary</td>
<td><a href="and.html">and</a></td>
</tr>
<tr>
<td>Binary</td>
<td><a href="xor.html">xor</a></td>
</tr>
<tr>
<td>lowest</td>
<td>Binary</td>
<td><a href="or.html">or</a></td>
</tr>
</table>
<hr align="left" width="50%">
</body>
</html>
|