【发布时间】:2021-11-13 13:53:27
【问题描述】:
我最近才开始深入研究 OCL 的复杂性。在我的第一次申请中,出现了以下问题:
有没有可能,如果有,在没有提供值的情况下,派生属性的正确方法是什么?
我想到但形式上可能不正确的方法是:
context GenericClass::genericAttribute : PrimitiveType
derive: if genericAttribute.oclIsUndefined() then
<expression of matching type>
endif
我能想到的另一种方法是
context GenericClass::genericAttribute : PrimitiveType
inv: genericAttribute.oclIsUndefined implies genericAttribute = <expression of matching type>
诚然,这两种方法似乎都有些尴尬,因此如果您能告诉我正式正确的方法,我会很高兴。
【问题讨论】:
标签: ocl