[Uml-devel] Whats next for associations? UML?
Brian Thomas
thomas at mail630.gsfc.nasa.gov
Tue Feb 11 08:56:04 UTC 2003
Hi again.
Im trying to hammer out my final code for the javacodegenerator fix up and I now see
that it would be desirable to have multiplicty (that is to say UML "notation") more strictly
controled by the program. Currently, notation is represented as a string, and you can put
anything you please there, which may or may not be valid notation.
At the very least, there should be some validation of the multiplicity string when it is input.
Even better, a small class should be created to control and hold this information, and this
small class should make it relatively easy for codegenerator writers to parse the meaning
of the notation. To quantify the needed functionality, here is a brief summary. The 1.4 UML
spec for notation is:
lower-bound .. upper-bound
where "lower-bound" and "upper-bound" must be non-negative integers. The range modifier
is the ".." which means all integers between the bounds exist. The upper-bound is not required,
and IF it isnt specified then the range indicator isnt used. The upper-bound must always be greater
than the lower-bound (if it is specified). There is one special symbol, the star '*' which has meaning
based on its use. If it appears as the lower-bound, it means all integers upto the upper-bound,
if the star is the upper-bound it means all numbers from the lower-bound and higher (to infinity), and
if the star appears alone it means all non-negative integers. There is one additional symbol in the
spec, the comma ',' which allows sets of ranges or numbers to be specified. Sets should always be
ordered in increasing numerical value.
(Whew). Here are serveral valid notation strings:
1
0..1
1..*
1,2..*
1,3..19,20..*
And so forth. I think that it would be relatively easy to implement some "MultiplicityValid(QString)" method
in the dialogs, but more desirable to have a full-fledged UMLNotation and UMLNotationSet classs to aid in
parsing out the code.
For example lets assume that a notation object has the last example value above ("1,3..19,20..*"), then in
use we should beable to have methods like:
notationObject->getNumberOfSets() returns "3"
notationObject->getSet(1) returns UMLNotationSet object this object has "lowerBoundValue" of 1 and
an upperBoundValue of "NONE" (no upperbound, its just a single number, the
NONE constant value could be defined to some negative integer like -1 or so)
notationObject->getNextSet() returns UMLNotationSet object (with string value "3,4,5,..,19"), calls to its
lowerBoundValue is "3" and its upperBoundValue will be "19"
notationObject->getNextSet() returns UMLNotationSet object with lowerBOundValue of "20" and the
upperBoundValue of "INFINITITY" (some integer constant we should define, perhaps "-9"?)
Of course, you should have methods to parse and validate QString to UMLNotationSet, and be able to have
a toString method on UMLNotation and UMLNotationSet.
Comments?
=b.t.
--
Classical music is the kind we keep thinking will turn into a tune.
-- Kin Hubbard, "Abe Martin's Sayings"
More information about the umbrello-devel
mailing list