Open ronaldtse opened 4 years ago
Operations
- Def.- An operation is a behavioral feature of a classifier, which specifies name, type, parameters and contraints for the call of the behavior.
In addition to the features and operation inherits from BehavioralFeature, the operation can:
- Have preconditions and postconditions and a body condition.
- Specify whether it will change the state of the pertaining instance (see isQuery).
- Have a type.
Notation and Semantics
- Although the syntax of operations is described somewhat imprecisely in the UML specification, the notation should look like this:
[visibility]name(parameter list) [:type][{property string}]
Operation Property
- {query} can be used to specify a property value for the operation.
- This characterizes an operation that has no side effects, that is, an operation that does not change the state of the object and other objects such as get() operations
Pre-Post-Body conditions
- The precondition must always be true before the operation is executed.
- The postconditions have to be true after the exection.
- The body condition has to be true during the execution.
- If an exception occurs during operation execution, the postconditions must not be true.
Difference between body condition and postcondition
- The difference between body condition and postcondition is that the invariant (of the body condition) can be overwritten (redefined) by inheritance.
- A postcondition merely lets you add postconditions. The latter is also true for a precondition.
Examples
getPosition(return x:int, return y:int)
Enlarge(byFactor:Real):GeomFigure
+addPhone(phone:String)
#release():contractStatus
@ronaldtse duplicate of #20 ?
Operations
- Def.- An operation is a behavioral feature of a classifier, which specifies name, type, parameters and contraints for the call of the behavior.
In addition to the features and operation inherits from BehavioralFeature, the operation can:
- Have preconditions and postconditions and a body condition.
- Specify whether it will change the state of the pertaining instance (see isQuery).
- Have a type.
This is the difference. An operation is a feature of the classifier (e.g. Class). It extends from feature by:
Operations
Notation and Semantics
[visibility]name(parameter list) [:type][{property string}]
Operation Property
Pre-Post-Body conditions
Difference between body condition and postcondition
Examples
getPosition(return x:int, return y:int)
Enlarge(byFactor:Real):GeomFigure
+addPhone(phone:String)
#release():contractStatus