How to visualize a relation between objects and variables
From OO Lab
Relation VM
When a pointer or a reference is used in a computer program, typically a programmer wants to establish a binary relation between two objects. Visualizing a binary relation is common and, in most cases, not dispensable. The visualization of a binary relation can be achieved in several ways in xDIVA.
First, any UBVM that has two ends like 3Dline_ubvm is best suitable for visualizing a binary relation.
Example city.java
Let's use city.java as an example to show how an 3Dline_ubvm can be used to represent a relation
- Open the example as follows:
- Visualize "map[0]" and choose ball_laser (in Composite tab) to visualize the reference.
- Click the grey ball to unfold the reference
- When mapping dialog pop up, please construct the following mapping
- In this mapping, we use a cube to represent variable _x and a sphere to represent _y.
- Open the set node attribute of cube and sphere by right click on them.
- Remember to click outport button (see Fig. below)
- Make _vm_rx, _vm_ry, vm_rz visible
- Add line_ubvm
- Complete the links as the above figure.
Finally, you will see a line is established between cube and sphere. You can drag the cube and sphere because the container we use is a freestyle container. You can replace line_ubvm with laser_ubvm if you like.