Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using multiplicity without navigability in UML is correct diagram?

enter image description here

I can see many UML example like above diagram. I can understand that

  1. Class A has navigability to B with multiplicity of 10. But I can't understand that
  2. Class B has no navigability to A but has multiplicity of 5..7. Is it possible has multiplicity wihtout navigability in UML?

I can implement case 1 like below.

class A {
public:
    B b[10];
};

But how can I implement case 2? No navigability but has multiplicity? I am totally confused of case 2. What am I missing?

like image 359
myoldgrandpa Avatar asked Dec 05 '25 15:12

myoldgrandpa


1 Answers

Yes, it is possible to have a multiplicity without navigability.

Navigability only makes a promise about the ease at runtime to find instances at the other end. The fact the there is no promise on navigability (or even an explicit absence of navigability with a X at the opposite end) does not change the existence of an association and hence the multiplicity.

The implementation of 2) could for example be done with a vector of pointers to A in B to navigate back (the navigability would exist, but is simply not indicated). Another implementation coukd be to use in A a vector of pointers to B, so that B can be shared, and some other mechanism make sure it is shared by 3 to 7 A's (no navigability, but multiplicity enforced)

like image 171
Christophe Avatar answered Dec 08 '25 11:12

Christophe



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!