
constraints.simple_allConstraints.ocl Maven / Gradle / Ivy
The newest version!
package tudresden::ocl20::pivot::examples::simple
-- The age of Person can not be negative.
context Person
inv: age >= 0
-- Students should be 16 or older.
context Student
inv: age > 16
-- Professors should be at least 30.
context Professor
inv: not (age < 30)
-- Returns the age of a Person.
context Person
def: getAge(): Integer = age
-- Before returning the age, the age must be defined.
context Person::getAge()
pre: not age.oclIsUndefined()
-- The result of getAge must equal to the age of a Person.
context Person::getAge()
post: result = age
endpackage
© 2015 - 2025 Weber Informatics LLC | Privacy Policy