Reply To: Creating Structured Data Types in OAL

homepage Forums BridgePoint/xtUML Usage and Training Creating Structured Data Types in OAL Reply To: Creating Structured Data Types in OAL

#5488
poj
Participant

The use of the where clause in the Var_B example becomes clearer in a longer segment of code.
[code title=””]
//Cs is a set of instances of class Class_C
select any Var_B from instances of Class_B where (False);
for each C in Cs
if (C.Foo)
select any Var_B related by C->Class_B[R47];
end if;
end for;
[/code]
This segment can be seen as a select from instances of Class_B with a where clause acting on a related class. Without the where-clause, the value of Var_B would be something unreasonable after the for-loop.

Actually, there is nothing in xtUML that says that an assignment is done at that point. By analyzing the body, a model compiler can easily remove an unnecessary assignment.

But back to the original question. In most cases, you should avoid structured data types, but when interfacing the outside world it is sometimes useful to be able to create values of a structured data type easily. For example when doing tests on your modeled domain, and you want to create a small model of the surrounding world that returns a value to your main concern.