Its value in the model element is then used to de?¬?ne if
isSingleton is set true or false, ???.setIsSingleton(true);??? or ???.setIsSingleton(false);???
Listing 6.1 A generator for producing singleton code.
01 Report '_isSingleton'
02 /*Singleton is true if multiplicity value is 0,1 or 1,1*/
03 if :Multiplicity = '1,1' or '0,1'
04 then '.setIsSingleton(true);'
05 else
06 '.setIsSingleton(false);'
07 endif
08 endreport
The names for the code, class name, attributes, operations, and so on, were taken
directly from the names used in models. Another alternative considered was allowing
the generator to produce unique names. This would work well for modelers since the
insurance modelers were not expected to view the code they generated. For
implementing the generator, however, it was considered better to use more descriptive
names that could be taken from the model. Mapping names closely to the model also
made the generators easier to test and later maintain. However, using just the name
from the model was not enough since the same name could be used for several things,
like the name of a cover and a related risk. For this reason, each name was extended
with its type name. If no property names were used, for example, often
AssociationEnd had no role names, the tool generated a unique name.
6.5.
Pages:
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266