OCL 样本详细信息

此样本模型是基于公司/职员域的一部分,例示了在下表中列示的 OCL 功能。
功能 样本模型中的位置
不变量约束 EmployeeConstraints, PersonConstraints
操作前置条件、后置条件和主体条件约束
  • 后置条件中的 @pre 表示法
  • 后置条件和主体条件中的结果表示法
CompanyConstraints, EmployeeConstraints, PersonConstraints
迭代器表达式:
  • 选择,forAll
CompanyConstraints
类型强制类型转换:
  • oclIsKindOf()
  • oclAsType()
CompanyConstraints, Stereotypes
引用枚举文字值 EmployeeConstraints
关联导航 EmployeeConstraints
受限关联导航 CompanyConstraints
关联类
  • 通过关联类导航
  • 从两端中的任意端导航至关联类
  • 从关联类导航至某个端
CompanyConstraints, EmployeeConstraints
LET 表达式 CompanyConstraints, PersonConstraints, Stereotypes
声明消息已发送的消息表达式 CompanyConstraints
迭代已发送消息的消息表达式 PersonConstraints
使用 OCL 以对 UML 概要文件进行约束 Stereotypes
引用其他包中的类型 Stereotypes
allInstances() 表达式 Stereotypes
if-then-else-endif 表达式 Stereotypes
未指定值表达式 PersonConstraints
oclIsInState() 操作 CompanyConstraints
Ad hoc 元模型约束 类图

反馈