OCL Is a formal language used to express constraints, that remains easy to read and write.
context Employee inv: self.age() >= 18
context Employee inv: self.hireDate > self.birthDate
context Employee inv:
self.supervisor→ notEmpty() implies self.age() < self.supervisor.age()
The condition notEmpty must be tested since the multiplicity of the role is not mandatory.
self.supervisor→ notEmpty() implies
self.salary < self.supervisor.salary
self.manages→ notEmpty() implies self.manages.startDate > self.hireDate
context Department inv:
self.worksFor→ includes(self.manages.employee)
self.worksOn→ size() <= 4
self.subordinates → excludes(self)
total contributions (1)
context Employee inv: self.age() >= 18
context Employee inv: self.hireDate > self.birthDate
context Employee inv:
self.supervisor→ notEmpty() implies self.age() < self.supervisor.age()
The condition notEmpty must be tested since the multiplicity of the role is not mandatory.
context Employee inv:
self.supervisor→ notEmpty() implies
self.salary < self.supervisor.salary
context Employee inv:
self.manages→ notEmpty() implies self.manages.startDate > self.hireDate
context Department inv:
self.worksFor→ includes(self.manages.employee)
context Employee inv:
self.worksOn→ size() <= 4
context Employee inv:
self.subordinates → excludes(self)