Enumeration

An Enumeration, often referred to as an Enum, is a special data type in UML and object-oriented programming that consists of a set of named constants. In Modeldraw, you can use Enumerations to model fixed sets of values in your system design, providing a way to represent concepts like days of the week, card suits, or status types.

An Enumeration in a Dependency relationship with a Class

Understanding Enumeration

Enumeration represents a fixed set of constants or instances in a system. Key characteristics include:

  • It defines a collection of related, named values

  • The set of values is finite and usually small

  • Each value in the enumeration is unique

  • Enumerations are often used to represent conceptual types with a limited number of possible values

Enumeration is represented in UML by a class-like structure with the «enumeration» stereotype.

Examples of enumerations:

  • Days of the Week: Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday

  • Card Suits: Hearts, Diamonds, Clubs, Spades

  • Traffic Light Colors: Red, Yellow, Green

The relationship between a class using an enumeration and the enumeration itself in Modeldraw is a dependency, not an aggregation or composition.

Creating an Enumeration

To create a new Enumeration:

  1. Select the Enumeration tool from the toolbox

  2. Click on the canvas where you want to place the Enumeration

Adding a Dependency

To create a Dependency between a Class and an Enumeration:

  1. Select the Dependency tool from the toolbox

  2. Click on a Class that uses the Enumeration

  3. Move above and click the Enumeration

Adding an Existing Enumeration to a Diagram

To add an existing Enumeration to a diagram:

  1. Open the diagram you want to add the Enumeration to

  2. Drag and drop the Enumeration from the navigation tree into the diagram

Last updated