list of dots Digital Research Alliance of Canada logo  NSERC logo  University of Ottawa logo / UniversitĂ© d'Ottawa

User Manual    [Previous]   [Next]   

Class Content

A class can contain any of the following items. Interfaces are limited to those indicated as [Allowed in interfaces]. A trait can contain most of the items, indicated as indicated as [Allowed in traits].

  • Comments describe the intent of your class (or interface), and any other elements in the class.[Allowed in interfaces] [Allowed in traits]

  • isA directives that specify a superclass to your class (i.e. a Supervisor could be descrbied as "isA Person"). A class can only have one isA clause referring to another class, but can have many referring to traits or interfaces. [More than one allowed in interfaces] [More than one allowed in traits]

  • An abstract; keyword, specifying that the class is abstract (cannot be instantiated, must have at least one concrete subclass).

  • Depend directives that describe external dependencies that might be used by your class within methods [Allowed in interfaces] [Allowed in traits].

  • Attributes describing simple data that can be found in any element of the class (i.e. name, dob, amount) [Allowed in traits]. These can be preceded by the keyword const to declare constants.

  • Inline associations that define links to instances of other classes (or to other instances of this class). [Allowed in traits] (can also be specified outside classes)

  • Methods that provide behaviour for the class. [Allowed in interfaces, but with no method body] [Allowed in traits] (state events are also methods, and methods can also be specified in states)

  • Enumerations for use inside this class (can also be specified outside classes)

  • State machine definitions that describe declaratively attributes that change value in certain behaviour patterns in response to actions such as method calls. [Allowed in traits]

  • A singleton directive that limits the system to only one instance of this class (e.g. there may only be one Bank in a banking system)[Allowed in traits]

  • An immutable directive that ensures that once constructed, an instance cannot be modified (under development).[Allowed in traits]

  • Key directives indicating which attributes (or in future, associations) are going to be used to define when one element is equal to another.[Allowed in traits]

  • Generation templates and emit methods for generating string output.

  • Invariant constraints. These are Boolean expressions that limit the values of attributes and other elements. [Allowed in traits] (other types of constraints can be specified in methods)

  • Mixset definitions that themselves contains other items that can be in classes. These allow for conditional compilation and are activated by use statements elsewhere.[Allowed in traits]

  • Class definitions nested inside this class that define subclass of this class as an alternative to using the isA clause. (these are not inner classes; those are defined as below)

  • Trace directives to direct generation of traces from the code. [Allowed in traits]

  • An inner class, specified either by the keyword inner or static, followed by a class definition. These are only relevant to Java generation.

  • Several other items to be documented later including the ability to colour classes in diagrams, and to specify test cases.

Syntax


// The following items can be found inside the body of classes or association classes
classContent- : [[comment]]
    | [[reqImplementation]]
    | [[innerClass]]
    | [[mixsetDefinition]]
    | [[distributable]]
    | [[proxyPattern]]
    | [[strictness]]
    | [[classDefinition]]
    | [[trace]]
    | [[emitMethod]]
    | [[templateAttributeDefinition]]
    | [[primitiveDefinition]]
    | [[portDefinition]]
    | [[portBindingDefinition]]
    | [[position]]
    | [[displayColor]]
    | [[abstract]]
    | [[keyDefinition]]
    | [[softwarePattern]]
    | [[depend]]
    | [[symmetricReflexiveAssociation]]
    | [[attribute]]
    | [[testCase]]
    | [[genericTestCase]]
    | [[testSequence]]
    | [[testClassInit]]
    | [[stateMachine]]
    | [[activeMethodDefinition]]
    | [[inlineAssociation]]
    | [[concreteMethodDeclaration]]
    | [[constantDeclaration]]
    | [[modelConstraint]]
    | [[invariant]]
    | ;
    | [[enumerationDefinition]]
    | [[exception]]
    | [[extraCode]]

traitContent- : [[mixsetDefinition]]
    | [[testCase]]
    | [[requiredModelElements]]
    | [[comment]]
    | [[reqImplementation]]
    | [[traitDefinition]]
    | [[trace]]
    | [[position]]
    | [[displayColor]]
    | [[abstract]]
    | [[keyDefinition]]
    | [[softwarePattern]]
    | [[depend]]
    | [[symmetricReflexiveAssociation]]
    | [[attribute]]
    | [[stateMachine]]
    | [[inlineAssociation]]
    | [[concreteMethodDeclaration]]
    | [[abstractMethodDeclaration]]
    | [[constantDeclaration]]
    | [[invariant]]
    | ;
    | [[exception]]
    | [[extraCode]]