uOttawaUniversity of Ottawa - Canadas University
list of dots

Umple User Manual    [Previous]   [Next]   

Loading

Preconditions

You can specify basic preconditions in methods as shown below. This is still under development.

Example

class PotentialVoter {
  Integer age;
  
  int vote(int candidate) {
    [pre: age >= 18]
    [pre: candidate > 0]
    // rest of stuff that we do not interpret
     return 0;
  }
}


      

Load the above code into UmpleOnline

 

Syntax


methodBody- : ( [[codeLangs]] { ( [[precondition]] | [[postcondition]] )* [**code] } )+

// Constraints in Umple.
// This is currently under development. Constraint capability is being
// developed in agile increments. The first step, described below,
// allows limiting the values of attributes. Code generation is not currently enabled.
// Constraints may appear in classes (including association classes)
// as well as in states.
precondition : [ [name]? pre : [[constraint]] ]