How to visualize a relation between objects and variables

From OO Lab
Jump to: navigation, search

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:

Linerelation-0.jpg

  • 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

Linerelation-1.jpg

  1. In this mapping, we use a cube to represent variable _x and a sphere to represent _y.
  2. Open the set node attribute of cube and sphere by right click on them.
  3. Remember to click outport button (see Fig. below)
  4. Make _vm_rx_vm_ryvm_rz visible
  5. Add line_ubvm
  6. Complete the links as the above figure.

Linerelation-2.jpg

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.

Linerelation-3.jpg

Personal tools