File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Junior/Associate Certification (SCJA,OCAJ 5/6/8) and the fly likes Multiplicity indicator Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Junior/Associate Certification (SCJA,OCAJ 5/6/8)
Bookmark "Multiplicity indicator" Watch "Multiplicity indicator" New topic

Multiplicity indicator

Vishal Gupta
Ranch Hand

Joined: Apr 01, 2008
Posts: 32
I have a doubt on Multiplicity indicator, for example class "ClassRoom" and "Chair" has association relationship as depicted below (with multiplicity indicator)

[ClassRoom] ----------------------- 1..* [Chair]

<fig 1> please assume [] as box and dashed line as solid line

I would read it as "ClassRoom has atleast one or more Chair" so the multiplicity would be "one to many" between ClassRoom and Chair???.

what if I place "1" near to ClassRoom:

[ClassRoom] 1 ----------------------- * [Chair]
<fig 2>
Now should I read it as "ClassRoom has zero or more Chair" because "*" denotes "Zero or more instances" and multiplicity would be "zero to many" between ClassRoom and Chair.
Do we need to always display multiplicity like figure 1? is figure 2 valid?

Can some one please clear my doubt?
[ August 11, 2008: Message edited by: Vishal Gupta ]

Vishal Gupta<br />------------<br />SCJA
Stephen Davies
Ranch Hand

Joined: Jul 23, 2008
Posts: 352
Hi Vishal,

I'm not sure if you have to place the one at the Classroom side. The fact that a Class is associated with AT LEAST one chair (1..*) one could assume that the chair would need a classroom in the diagram. I think what is more significant in this case, is if there is the existence of accessors / mutators (getters / setters) and any navigable relationship, this perhaps would verify more the definition of the multiplicity relationship.

However, saying that, if you were to put a one next to the classroom diagram, would this not suggest composition, and therefore would the line also require a solid diamond shape, as a chair would need one classroom? Destroy the classroom the chairs are then destroyed.

This is my understanding, hope it helps, of course anyone may correct me if I am wrong

be a well encapsulated person, don't expose your privates, unless you public void getWife()!
Vishal Gupta
Ranch Hand

Joined: Apr 01, 2008
Posts: 32
Thanks Stephen..
I think I haven't stated the question correctly. I would like to know that
is fig 2 valid way of showing multiciplity?.
because (i think) mentioning 1..* on class "Chair" side is entirely different than 1------ * (i.e both on opposit side). And the relationship is 'asscociation' always. please let me know if it helps.
[ August 13, 2008: Message edited by: Vishal Gupta ]
I agree. Here's the link:
subject: Multiplicity indicator
It's not a secret anymore!