-- OCL constraints
constraints
context Department
-- the number of employees working in a department must
-- be greater or equal to the number of projects
-- controlled by the department
inv MoreEmployeesThanProjects:
self.employee->size >= self.project->size
context Employee
-- employees get a higher salary when they work on
-- more projects
inv MoreProjectsHigherSalary:
Employee.allInstances->forAll(e1, e2 |
e1.project->size > e2.project->size
implies e1.salary > e2.salary)
context Project
-- the budget of a project must not exceed the
-- budget of the controlling department
inv BudgetWithinDepartmentBudget:
self.budget <= self.department.budget
-- employees working on a project must also work in the
-- controlling department
inv EmployeesInControllingDepartment:
self.department.employee->includesAll(self.employee)