15.3. Datatype

Datatypes can be thought of as simple classes. They have no attributes, and any operations on them must have no side-effects. A useful analogy is primitive datatypes in a language like Java. The integer “3” stands on its own—it has no inner structure. There are operations (for example addition) on the integers, but when I perform 3 + 4 the result is a new number, “3” and “4” are unchanged by the exercise.

Within UML 1.3, DataType is a sub-class of the Classifier metaclass. It embraces the predefined primitive types (byte, char, double, float, int, long and short), the predefined enumeration, boolean and user defined enumeration types.

[Note]Note

Also void is implemented as a datatype within ArgoUML

[Caution]Caution

Within ArgoUML 0.14 new datatypes may be created using the New datatype button on the property tabs of existing datatypes only. This function really should be present on the property tabs of the model and packages, too.

[Tip]Tip

As a consequence, when starting a new model, a trick is needed to create the first datatype. The easiest way is to create an operation (on a class) and select the return parameter, and set it to any predefined datatype, e.g. int. From this moment on, the datatype int will be present in the explorer and its property tabs contains the New Datatype button.

[Note]Note

UML 1.3 allows user defined datatypes to be placed on class diagrams. This is not permitted in ArgoUML.

15.3.1. Datatype Details Tabs

The details tabs that are active for datatypes are as follows.

ToDoItem

Standard tab.

Properties

See Section 15.3.2, “Datatype Property Toolbar” and Section 15.3.3, “Property Fields For Datatype” below.

Documentation

Standard tab. See Section 12.5, “Documentation Tab”.

Source

Standard tab. Unused. One would expect a class declaration for the new datatype to support code generation.

Constraints

Standard tab. ArgoUML only supports constraints on Classes and Features (Attributes, Operations, Receptions, and Methods), so this tab is grayed out.

Tagged Values

Standard tab. In the UML metamodel, Datatype has the following standard tagged values defined.

  • persistence (from the superclass, Classifier). Values transitory, indicating state is destroyed when an instance is destroyed or persistent, marking state is preserved when an instance is destroyed.

    [Tip]Tip

    Since user defined datatypes are enumerations, they have no state to preserve, and the value of this tagged value is irrelevant.

  • semantics (from the superclass, Classifier). The value is a specification of the semantics of the datatype.

  • derived (from the superclass, ModelElement). Values true, meaning the class is redundant—it can be formally derived from other elements, or false meaning it cannot.

    [Tip]Tip

    While formally available, a derived datatype does not have an obvious value, and so datatypes should always be marked with derived=false.

15.3.2. Datatype Property Toolbar

Go up

Navigate up through the package structure.

New datatype

This creates a new datatype (see Section 17.5, “Class”) within the same package as the current datatype.

[Tip]Tip

While it can make sense to create datatypes this way, it can be clearer to create them within the package or model where you want them.

Add enumeration literal

This creates a new enumeration literal within the datatype, navigating immediately to the properties tab for that literal.

[Caution]Caution

ArgoUML does not actually have a separate concept of a literal. The navigation will navigate to the property sheet for an attribute of a class (see Section 17.6, “Attribute”). When defining a literal, all that matters is its name. Other parts of the attribute property sheet should be ignored. Also the name of the literal must obey the rules for an Attribute or a critic will fire.

Delete

This deletes the datatype from the model.

15.3.3. Property Fields For Datatype

Name

Text box. The name of the datatype. The primitive datatypes all have lower case names, but there is no formal convention.

[Note]Note

The default name supplied for a newly created datatype is the empty string “”. Datatypes with empty string names will appear with the name (anon Datatype) in the explorer.

Stereotype

Drop down selector. Package is provided by default with the UML standard stereotypes for classifier (metaclass, powertype, process, thread and utility).

[Tip]Tip

The stereotype enumeration should always be used for any created enumeration datatypes.

[Caution]Caution

In version 0.14 the enumeration must be created before it can be used.

Navigate Stereotype

icon. If a stereotype has been selected, this will navigate to the stereotype property panel (see Section 15.4, “Stereotype”).

Namespace

Drop down selector. Allows changeing the namespace for the datatype. This is the package hierarchy.

Modifiers

Check box, with entries Abstract, Leaf and Root.

  • Abstract is used to declare that this datatype cannot be instantiated, but must always be specialized.

    [Note]Note

    ArgoUML provides no mechanism for specializing datatypes, so this check box is of little use.

  • Leaf indicates that this datatype can have no further sub-types, while Root indicates it is a top level datatype.

    [Tip]Tip

    In the absence of specialization of datatypes within ArgoUML these have little value. In effect all datatypes are both Root and Final

Generalizations

Text area. Lists any datatype that generalizes this datatype.

[Caution]Caution

It is not clear that generalizing datatypes makes much sense.

Specializations

Text box. Lists any specialized datatype (i.e. for which this datatype is a generalization.

[Caution]Caution

It is not clear that specializing datatypes makes much sense.

Dependency

Text box. Lists any abstract classes or interfaces realized by this datatype. By default this is empty.

[Caution]Caution

It is not clear that Dependency datatypes makes much sence.

Operations

Text area. Lists all the operations defined on this datatype. Button 1 double click navigates to the selected operation.

See Section 17.7, “Operation” for details of operations.

Since V0.14 does not provide in any means to create operations of datatypes, this field is not useful.

Literals

Text area. Lists all the enumeration literals defined for this datatype. Button 1 click navigates to the selected literal, button 2 click brings up a pop up menu with three entries.

  • Open. Navigate to the selected literal.

  • New. Add a new literal and navigate to it.

  • Delete. Removes the selected literal from the model.

[Caution]Caution

ArgoUML does not actually have a separate concept of a literal. The navigations listed above will all navigate to the property sheet for an attribute of a class (see Section 17.6, “Attribute”). When defining a literal, all that matters is its name. Other parts of the attribute property sheet should be ignored.