Software Disclaimer

Class UML 2.4.1::Operation

Description:

An operation is a behavioral feature of a classifier that specifies the name, type, parameters, and constraints for invoking an associated behavior.An operation may invoke both the execution of method behaviors as well as other behavioral responses.Operation specializes TemplateableElement in order to support specification of template operations and bound operations. Operation specializes ParameterableElement to specify that an operation can be exposed as a formal template parameter, and provided as an actual parameter in a binding of a template.

Direct Superclasses: TemplateableElement, BehavioralFeature, ParameterableElement

Direct Subclasses:

Class Precedence List: Operation, TemplateableElement, BehavioralFeature, Namespace, Feature, RedefinableElement, NamedElement, ParameterableElement, Element

Properties:

bodyCondition : Constraint (0 1); -- source Operation
class : Class (0 1); -- source Operation
datatype : DataType (0 1); -- source Operation
interface : Interface (0 1); -- source Operation
isOrdered : Boolean (1 1); -- source Operation
isQuery : Boolean (1 1); -- source Operation
isUnique : Boolean (1 1); -- source Operation
lower : Integer (0 1); -- source Operation
postcondition : Constraint (0 *); -- source Operation
precondition : Constraint (0 *); -- source Operation
redefinedOperation : Operation (0 *); -- source Operation
templateParameter : OperationTemplateParameter (0 1); -- source Operation
type : Type (0 1); -- source Operation
upper : UnlimitedNatural (0 1); -- source Operation
ownedTemplateSignature : TemplateSignature (0 1); -- source TemplateableElement
templateBinding : TemplateBinding (0 *); -- source TemplateableElement
concurrency : CallConcurrencyKind (1 1); -- source BehavioralFeature
isAbstract : Boolean (1 1); -- source BehavioralFeature
method : Behavior (0 *); -- source BehavioralFeature
ownedParameter : Parameter (0 *); -- source BehavioralFeature
ownedParameterSet : ParameterSet (0 *); -- source BehavioralFeature
raisedException : Type (0 *); -- source BehavioralFeature
elementImport : ElementImport (0 *); -- source Namespace
importedMember : PackageableElement (0 *); -- source Namespace
member : NamedElement (0 *); -- source Namespace
ownedMember : NamedElement (0 *); -- source Namespace
ownedRule : Constraint (0 *); -- source Namespace
packageImport : PackageImport (0 *); -- source Namespace
featuringClassifier : Classifier (0 *); -- source Feature
isStatic : Boolean (1 1); -- source Feature
isLeaf : Boolean (1 1); -- source RedefinableElement
redefinedElement : RedefinableElement (0 *); -- source RedefinableElement
redefinitionContext : Classifier (0 *); -- source RedefinableElement
clientDependency : Dependency (0 *); -- source NamedElement
name : String (0 1); -- source NamedElement
nameExpression : StringExpression (0 1); -- source NamedElement
namespace : Namespace (0 1); -- source NamedElement
qualifiedName : String (0 1); -- source NamedElement
visibility : VisibilityKind (0 1); -- source NamedElement
owningTemplateParameter : TemplateParameter (0 1); -- source ParameterableElement
ownedComment : Comment (0 *); -- source Element
ownedElement : Element (0 *); -- source Element
owner : Element (0 1); -- source Element

Constraints:

Signature: CMOF_14_3_17a() : Boolean;
Description: 14.3 [17] An Operation can have up to one Parameter whose direction is 'return'; furthermore, an Operation cannot have any ParameterSet per 12.4 [8].
Expression: ownedParameter->select(direction = ParameterDirectionKind::return)->size() < 2 and ownedParameterSet->isEmpty()

Signature: CMOF_14_3_2() : Boolean;
Description: 14.3 [2] The type of Operation::raisedException is limited to be Class rather than Type. see also: https://sites.google.com/site/metamodelingantipatterns/catalog/mof/operation-has-non-class-exception
Expression: raisedException->forAll(e | e.oclIsTypeOf(Class))

Signature: only_body_for_query() : Boolean;
Description: A bodyCondition can only be specified for a query operation.
Expression: bodyCondition->notEmpty() implies isQuery

Signature: at_most_one_return() : Boolean;
Description: An operation can have at most one return parameter; i.e., an owned parameter with the direction set to 'return'
Expression: self.ownedParameter->select(par | par.direction = #return)->size() <= 1

Operations:

Signature: upper.1() : UnlimitedNatural;
Description: If this operation has a return parameter, upper equals the value of upper for that parameter. Otherwise upper is not defined.
Expression: result = if returnResult()->notEmpty() then returnResult()->any().upper else Set{} endif

Signature: type.1() : Type;
Description: If this operation has a return parameter, type equals the value of type for that parameter. Otherwise type is not defined.
Expression: result = if returnResult()->notEmpty() then returnResult()->any().type else Set{} endif

Signature: returnResult() : Parameter;
Description: The query returnResult() returns the set containing the return parameter of the Operation if one exists, otherwise, it returns an empty set
Expression: result = ownedParameter->select (par | par.direction = #return)

Signature: lower.1() : Integer;
Description: If this operation has a return parameter, lower equals the value of lower for that parameter. Otherwise lower is not defined.
Expression: result = if returnResult()->notEmpty() then returnResult()->any().lower else Set{} endif

Signature: isUnique.1() : Boolean;
Description: If this operation has a return parameter, isUnique equals the value of isUnique for that parameter. Otherwise isUnique is true.
Expression: result = if returnResult()->notEmpty() then returnResult()->any().isUnique else true endif

Signature: isOrdered.1() : Boolean;
Description: If this operation has a return parameter, isOrdered equals the value of isOrdered for that parameter. Otherwise isOrdered is false.
Expression: result = if returnResult()->notEmpty() then returnResult()->any().isOrdered else false endif

Signature: isConsistentWith(redefinee : RedefinableElement; ) : Boolean;
Description: A redefining operation is consistent with a redefined operation if it has the same number of owned parameters, and the type of each owned parameter conforms to the type of the corresponding redefined parameter. The query isConsistentWith() specifies, for any two Operations in a context in which redefinition is possible, whether redefinition would be consistent in the sense of maintaining type covariance. Other senses of consistency may be required, for example to determine consistency in the sense of contravariance. Users may define alternative queries under names different from 'isConsistentWith()', as for example, users may define a query named 'isContravariantWith()'.
The OCL used here is not normative.
Editor's notes: Needs investigation
Expression: true
Original: redefinee.isRedefinitionContextValid(self) result = redefinee.oclIsKindOf(Operation) and let op : Operation = redefinee.oclAsType(Operation) in self.ownedParameter->size() = op.ownedParameter->size() and Sequence{1..self.ownedParameter->size()}-> forAll(i |op.ownedParameter->at(1).type.conformsTo(self.ownedParameter->at(i).type))



Send questions or comments to [email protected].