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

Within ArgoUML new datatypes may be created using the New datatype button on the property tabs of the model and packages (in which case the new datatype is restricted in scope to the package), as well as the properties tab for datatype.

[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.4, “Documentation Tab”.

Source

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

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.

New 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.

New Operation

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

New Stereotype

This creates a new Stereotype (see Section 15.5, “Stereotype”) within the same package as the datatype, navigating immediately to the properties tab for that stereotype.

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. Stereotype 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 ArgoUML version 0.18 the stereotype enumeration must be created before it can be used. However, by creating an Enumeration Literal, the stereotype enumeration is created automatically.

Navigate Stereotype

icon. If a stereotype has been selected, this will navigate to the stereotype property panel (see Section 15.5, “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

Visibility

Radio box, with entries public, private, protected, and package.

Records the visibility for the Datatype.

Client Dependencies

Text area. Lists any elements that depend on this datatype.

[Caution]Caution

It is not clear that dependencies between datatypes makes much sense.

Supplier Dependencies

Text area. Lists any elements that this datatype depends on.

[Caution]Caution

It is not clear that dependencies between datatypes makes much sense.

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.

Operations

Text area. Lists all the operations defined on this datatype. Button 1 double click navigates to the selected operation. button 2 click brings up a pop up menu with two entries.

  • Move Up. Only available where there are two or more operations, and the operation selected is not at the top. It is moved up one.

  • Move Down. Only available where there are two or more operations listed, and the operation selected is not at the bottom. It is moved down one.

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

[Caution]Caution

ArgoUML treats all operations as equivalent. Any operations created here will use the same mechanism as operations for classes. Remember that operations on datatypes must have no side effects (they are read-only). This means the query modifier must be checked for all operations.

Literals

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

  • Move Up. Only available where there are two or more literals, and the literal selected is not at the top. It is moved up one.

  • Move Down. Only available where there are two or more literals listed, and the literal selected is not at the bottom. It is moved down one.

[Caution]Caution

ArgoUML does not actually have a separate concept of a literal. The navigations listed above will all navigate to a property sheet equal to 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.