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

User Manual    [Previous]   [Next]   

Requirements

Requirements allow for the same comment to appear in different sections of the code without typing out the comment multiple times.

They consist of two components: the requirement definition, which contains the comment statement to be added, and the requirement implementation, which specifies where the requirement statement should be added.

Multiple requirements can be called through an implementsReq statement.


A requirement can be tagged with multiple entities like classes, attributes, associations, state machines, traits, methods, interface etc.


Example

req R01 {
  This is a comment we would like to add
  multiple times in different locations.

  The identifier used for this requirement is
  R01.
}

req R02 {
  This is a second requirement statement.
}

implementsReq R01;
class Example {
  implementsReq R02;
  var1;
  var2; implementsReq R01, R02;
}
      

Load the above code into UmpleOnline

 

Requirement tagging with multiple entities

req R1 {
  First requirement with the identifier R1.
}


req R2 {
  Second requirement with the identifier R2.
}


req R3 {
  Third requirement with the identifier R3.
}


req R4 {
  Fourth requirement with the identifier R4.
}


req R5 {
  Fifth requirement with the identifier R5.
}


req R6 {
  Sixth requirement with the identifier R6.
}


// Requirements tagged with class
implementsReq R3;
class A {
  
  // Requirements tagged with attribute
  implementsReq R2;
  att1;
}


// A second class
class B {
  
  // Requirement tagged with association
  implementsReq R2;
  * -> * A;
  
  // Requirement tagged with state machine
  implementsReq R3;
  sm {
    s1 {
      e -> s2;
    }
    s2 {
    }
  } 
  
  // Requirement tagged with method
  implementsReq R5;
  String m1(String s) {
    return(s);
  }
}


// Requirement tagged with trait 
implementsReq R4;
trait C {
   g;
}


// Requirement tagged with interface
implementsReq R6;
interface Itest {
  String m2(String s);
}



      

Load the above code into UmpleOnline