PDA

View Full Version : UML question



endo
07-02-2002, 10:03 AM
How do I represent an enumeration in UML, specifically using rational Rose?

tia

Strider
07-02-2002, 12:47 PM
I believe that it would look something similar to this:



__________________________________________
| SampleClass |
|__________________________________________|
| |
| +sampleEnum : SampleEnum = Yes {Yes, No} |
|__________________________________________|
|__________________________________________|


The property-list being {Yes, No}.

David

endo
07-03-2002, 03:47 PM
So that would be equivalent to:


enum SampleEnum
{
yes,
no
};

would it? And defined as a member of a class? At the moment I have this (see below) but I'm not sure how it fits together in UML (my book uses Java :()


enum SEX
{
MALE,
FEMALE
};

class Student
{
public:
//stuff
private:
//some data members +
SEX sex;
};

thx for the help, much appreciated :D

TK
07-03-2002, 04:11 PM
Just make sure that you can tell that the data type is enum but listing all the enumerations is a good ideas if they will fit. You could also attach a note icon.

Strider
07-05-2002, 06:09 AM
The format is as follows:

<name> : <type> = <default> {<parameter list, ...>}

so...

enum SEX
{
MALE,
FEMALE
};

class Student
{
public:
//stuff
private:
//some data members +
SEX sex;
};


would look similar to this:

__________________________________
| Student |
|__________________________________|
| |
| +sex : SEX = MALE {MALE, FEMALE} |
|__________________________________|
|__________________________________|

David