Login | Register
My pages Projects Community openCollabNet

16.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.4, 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. Datatypes can also be created with the tool in the diagram toolbar of a class diagram.

The UML 1.4 standard allows user defined datatypes to be placed on class diagrams to define their inheritence structure. This is also possible in ArgoUML. It is represented on the diagram by a box with two compartments, of which the top one is marked with «datatype», and contains the name. The lower one contains operations.

16.3.1. Datatype Details Tabs

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

ToDoItem

Standard tab.

Properties

See Section 16.3.2, “Datatype Property Toolbar” and Section 16.3.3, “Property Fields For Datatype” below.

Documentation

Standard tab. See Section 13.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.

16.3.2. Datatype Property Toolbar

Go up

Navigate up through the package structure.

New datatype

This creates a new datatype (see Section 18.6, “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

This creates a new Enumeration (see Section 16.4, “Enumeration”) in the same package as the datatype, navigating immediately to the properties tab for that Enumeration.

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 16.6, “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.

16.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 (Unnamed Datatype) in the explorer.

Namespace

Drop down selector with navigate button. Allows changing 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

    You can define the specialization of datatypes in a class diagram by drawing generalizations between them.

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.

Specializations

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

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 18.8, “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.