0

I want to model a association between two classes in UML, that says "an object of class A can have 0 objects of class B or 6 objects of class B". I don't want 0 to 6 elements, I want 0 or 6, nothing in between.

How do I model this? 0 to 6 is "0..6", but was is 0 or 6? Must I use an OCL constrain?

I'm using Magic Draw.

Thanks.

Thomas Uhrig
  • 30,811
  • 12
  • 60
  • 80

1 Answers1

2

You can represent multiple groupings with commas i.e. 1..3, 5..6 for leaving 4 out of a list from 1 to 6, so I don't see why you can't do that with distinct numbers i.e. 0, 6

Brian J
  • 694
  • 1
  • 21
  • 34
  • 1
    In fact, this was true in earlier versions of the UML but I think in the latest ones they simplified this and only allow a single interval. – Jordi Cabot Jul 02 '12 at 22:20