SDA SE Wiki

Software Engineering for Smart Data Analytics & Smart Data Analytics for Software Engineering

User Tools

Site Tools


Task 19: OCL constraints (possible solution)

A user may only rent one copy of the same movie.

context User
inv: rentedCopy->isUnique(movie)

Alternative:1)

context User
inv: rentedCopy.movie->asSet() = rentedCopy.movie

Only 5% of a store's inventory may be in the hands of untrusted or underaged users.

contex Store
inv: owner->select(!user.trusted or user.age < 18)->size() / owner.user->size() <= 0.05
1)
since isUnique was not mentioned on the slides
teaching/lectures/oosc/2009/task19_solution.txt · Last modified: 2018/05/09 01:59 (external edit)

SEWiki, © 2022