You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Max Leuthäuser edited this page Nov 18, 2021
·
6 revisions
Title
Objects may play the same role (type) several times
Description
Unlike feature 3 this does not correspond to multiple classification of an object.
Instead it should be possible that each occurrence of an object in a role is associated with a different state.
E.g. an employee has one salary and one office address per job.
Implementation
Simply instantiate a role multiple times and attach it.
valsomeCoreA=newCoreA()
valsomeRole1=newRoleA()
valsomeRole2=newRoleA()
someCoreA play someRole1
someCoreA play someRole2
To distinguish between role instances of the same role type SCROLL uses their object identity (equals- and hashCode-methods). So be careful when overriding/implementing them manually.