The other main kinds of relationship whose rules required thought were the time
operations. We decided to implement these as Plus, Minus, and Set roles. The
contents of the variables pointed to by the Plus and Minus roles are added and
subtracted appropriately, and the result of the operation is stored in the variable
pointed to by the Set role. There could thus be one Set role, and zero to many Plus or
Minus roles. As this left the unsatisfactory possibility of a relationship with one Set
role and no other roles, we decided that there should also be a Get role, which would
point to the ?¬?rst variable term in the operation. Thus, for something like
MODELING LANGUAGE 205
???stopTime = sysTime startTime??? stopTime would be in a Set role, sysTime in a
Get role, and startTime in a Minus role.
As it turned out, this was a good decision for code generation: the ?¬?rst term in a
calculation is not generally preceded by a plus or minus sign. It was, however, a
slightly poor decision in terms of modeling all possible calculations: for example,
???stopTime = startTime.??? Interestingly, there has not yet been a need for such a
calculation. Still, perhaps a better solution would be to replace the Get, Plus, and
Minus roles with a single Get role with a property specifying whether it was Minus
or Plus.
Pages:
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380