Visual OCL

TU-Berlin | Faculty IV | Institute ISTI | Research group TFS

User Guide for the Eclipse VOCL-Plugin
group 2

small logo
section: < previous | next >
| |
chapter: << previous | next >>

3.2 Boolean Expressions


In this section boolean expressions in VOCL are introduced in order to create more complex constraints. The editor offers to draw several kinds of boolean expression. These are AND, OR, XOR and IMPLIES. Moreover, the expressions can be negated via the context menu.

 

3.2.1 Negate a VOCL expression

The editor can negate navigation and boolean expressions. For negating a VOCL expression you have to create a navigation expression at least. In Fig. 4.2.1 you can see a very simple navigation expression, in this case a attribute navigation. Via the context menu (see Fig. 4.2.2) you negate / unnegate this expression. A negation is displayed by two lines that go from the left top to the right bottom corner and from the left bottom to the right top corner (see Fig. 4.2.3). In order to unnegate a VOCL expression you have to select simply the context menu entry again.


Fig. 3.2.1 - attribute navigation

Fig. 3.2.2 - Negation of a VOCL expression via the context menu


Fig. 3.2.3 - Negated expression


Fig. 3.2.4 - Resulting OCL expression


3.2.2 Creating Boolean expressions

In order to create a boolean expression you have to select the palette entry BoolExpression and move the mouse cursor into a Constraint. Then a dialog is opened (see Fig 4.2.5). There you can choose between three different types of boolean expression (OR; XOR; IMPLIES) and set the aligment of the dividing line (see Fig. 4.2.6). 


Fig. 3.2.5 - dialog for creating boolean expression

There are some special facts you have to pay attention to:
  • the boolean expression AND is not created in the way as described above. It is drawn implicitly, e.g. if you draw two navigation expression they are connected via the AND expression
  • you have to create the boolean expression first and then the navigation expressions.


Fig. 3.2.6 - boolean expression example

In the examples below you see several possibities of negating a boolean expression with the corresponding OCL-Strings besides. In Fig. 3.2.7 the OR expression is negated. This can be done by opening the context menu when the cursor is on the label or.  If you want to negate only a part of a boolean expression then you have to move the cursor in that part and choose negate VOCLExpression in the context menu (see Fig. 3.2.8).




Fig. 3.2.7 - negation of the whole boolean expression




Fig. 3.2.8 - negation of a part of a boolean expression
©2005 TFS