Class Operation
An operation is owned by a class and may be invoked in the context of objects that are instances of that class. It is a typed element and a multiplicity element.
[AlternativeNamespace("http://schema.omg.org/spec/mof/2.0/emof.xmi")]
[XmlNamespace("http://schema.omg.org/spec/MOF/2.0/cmof.xml")]
[XmlNamespacePrefix("cmof")]
[ModelRepresentationClass("http://schema.omg.org/spec/MOF/2.0/cmof.xml#//Operation")]
public class Operation : Feature, IOperation, ITypedElement, IMultiplicityElement, IBehavioralFeature, IFeature, IRedefinableElement, INamespace, INamedElement, IElement, IModelElement, INotifyPropertyChanged, INotifyPropertyChanging
- Inheritance
-
Operation
- Implements
- Inherited Members
Constructors
Operation()
Creates a new instance
public Operation()
Properties
BodyCondition
The bodyCondition property
[Browsable(false)]
[XmlElementName("bodyCondition")]
[XmlAttribute(false)]
[Containment]
public IOrderedSetExpression<IConstraint> BodyCondition { get; }
Property Value
Children
Gets the child model elements of this model element
public override IEnumerableExpression<IModelElement> Children { get; }
Property Value
Class
The class that owns the operation. Subsets RedefinableElement::redefinitionContext and NamedElement::namespace and Feature::featuringClassifier. The class that owns the operation.
[Browsable(false)]
[XmlElementName("class")]
[XmlAttribute(true)]
[XmlOpposite("ownedOperation")]
public IClass Class { get; set; }
Property Value
ClassInstance
Gets the Class model for this type
public static IClass ClassInstance { get; }
Property Value
Datatype
The DataType that owns this Operation. Subsets NamedElement::namespace, Feature::featuringClassifier, and RedefinableElement::redefinitionContext.
[Browsable(false)]
[XmlElementName("datatype")]
[XmlAttribute(true)]
[XmlOpposite("ownedOperation")]
public IDataType Datatype { get; set; }
Property Value
ElementImport
References the ElementImports owned by the Namespace. Subsets Element::ownedElement.
[Browsable(false)]
[XmlElementName("elementImport")]
[XmlAttribute(false)]
[Containment]
[XmlOpposite("importingNamespace")]
public IOrderedSetExpression<IElementImport> ElementImport { get; }
Property Value
IsOrdered
For a multivalued multiplicity, this attribute specifies whether the values in an instantiation of this element are sequentially ordered. Default is false.
[TypeConverter(typeof(LowercaseBooleanConverter))]
[XmlElementName("isOrdered")]
[XmlAttribute(true)]
public bool IsOrdered { get; set; }
Property Value
IsQuery
Specifies whether an execution of the BehavioralFeature leaves the state of the system unchanged (isQuery=true) or whether side effects may occur (isQuery=false). The default value is false.
[TypeConverter(typeof(LowercaseBooleanConverter))]
[XmlElementName("isQuery")]
[XmlAttribute(true)]
public bool IsQuery { get; set; }
Property Value
IsUnique
For a multivalued multiplicity, this attributes specifies whether the values in an instantiation of this element are unique. Default is true.
[TypeConverter(typeof(LowercaseBooleanConverter))]
[XmlElementName("isUnique")]
[XmlAttribute(true)]
public bool IsUnique { get; set; }
Property Value
Lower
Specifies the lower bound of the multiplicity interval. Default is one.
[XmlElementName("lower")]
[XmlAttribute(true)]
public int? Lower { get; set; }
Property Value
- int?
OwnedParameter
Specifies the ordered set of formal parameters of this BehavioralFeature.
[Browsable(false)]
[XmlElementName("ownedParameter")]
[XmlAttribute(false)]
[Containment]
public IOrderedSetExpression<IParameter> OwnedParameter { get; }
Property Value
PackageImport
References the PackageImports owned by the Namespace. Subsets Element::ownedElement.
[Browsable(false)]
[XmlElementName("packageImport")]
[XmlAttribute(false)]
[Containment]
[XmlOpposite("importingNamespace")]
public IOrderedSetExpression<IPackageImport> PackageImport { get; }
Property Value
Postcondition
The postcondition property
[Browsable(false)]
[XmlElementName("postcondition")]
[XmlAttribute(false)]
[Containment]
public IOrderedSetExpression<IConstraint> Postcondition { get; }
Property Value
Precondition
The precondition property
[Browsable(false)]
[XmlElementName("precondition")]
[XmlAttribute(false)]
[Containment]
public IOrderedSetExpression<IConstraint> Precondition { get; }
Property Value
RaisedException
References the Types representing exceptions that may be raised during an invocation of this feature.
[XmlElementName("raisedException")]
[XmlAttribute(true)]
public ISetExpression<IType> RaisedException { get; }
Property Value
RedefinedOperation
References the Operations that are redefined by this Operation. Subsets RedefinableElement.redefinedElement.
[XmlElementName("redefinedOperation")]
[XmlAttribute(true)]
public ISetExpression<IOperation> RedefinedOperation { get; }
Property Value
ReferencedElements
Gets the referenced model elements of this model element
public override IEnumerableExpression<IModelElement> ReferencedElements { get; }
Property Value
Type
Redefines the corresponding property from Basic to derive this information from the return result for this Operation. The type of the TypedElement.
[XmlElementName("type")]
[XmlAttribute(true)]
public IType Type { get; set; }
Property Value
Upper
Specifies the upper bound of the multiplicity interval. Default is one.
[XmlElementName("upper")]
[XmlAttribute(true)]
public int? Upper { get; set; }
Property Value
- int?
Methods
At_most_one_return(object, object)
An operation can have at most one return parameter; i.e., an owned parameter with the direction set to 'return' self.ownedParameter->select(par | par.direction = #return)->size() <= 1
public bool At_most_one_return(object diagnostics, object context)
Parameters
Returns
ExcludeCollisions(IEnumerable<IPackageableElement>)
The query excludeCollisions() excludes from a set of PackageableElements any that would not be distinguishable from each other in this namespace. result = imps->reject(imp1 | imps.exists(imp2 | not imp1.isDistinguishableFrom(imp2, self)))
public ISetExpression<IPackageableElement> ExcludeCollisions(IEnumerable<IPackageableElement> imps)
Parameters
Returns
GetAttributeValue(string, int)
Resolves the given attribute name
protected override object GetAttributeValue(string attribute, int index)
Parameters
Returns
- object
The attribute value or null if it could not be found
GetClass()
Gets the Class for this model element
public override IClass GetClass()
Returns
GetCollectionForFeature(string)
Gets the Model element collection for the given feature
protected override IList GetCollectionForFeature(string feature)
Parameters
feature
stringThe requested feature
Returns
- IList
A non-generic list of elements
GetCompositionName(object)
Gets the property name for the given container
protected override string GetCompositionName(object container)
Parameters
container
objectThe container object
Returns
- string
The name of the respective container reference
GetExpressionForAttribute(string)
Gets the property expression for the given attribute
protected override INotifyExpression<object> GetExpressionForAttribute(string attribute)
Parameters
attribute
stringThe requested attribute in upper case
Returns
- INotifyExpression<object>
An incremental property expression
GetExpressionForReference(string)
Gets the property expression for the given reference
protected override INotifyExpression<IModelElement> GetExpressionForReference(string reference)
Parameters
reference
stringThe requested reference in upper case
Returns
- INotifyExpression<IModelElement>
An incremental property expression
GetImportedMembers()
The importedMember property is derived from the ElementImports and the PackageImports. References the PackageableElements that are members of this Namespace as a result of either PackageImports or ElementImports. result = self.importMembers(self.elementImport.importedElement.asSet()->union(self.packageImport.importedPackage->collect(p | p.visibleMembers())))
public ISetExpression<IPackageableElement> GetImportedMembers()
Returns
GetModelElementForReference(string, int)
Resolves the given URI to a child model element
protected override IModelElement GetModelElementForReference(string reference, int index)
Parameters
Returns
- IModelElement
The model element or null if it could not be found
GetNamesOfMember(INamedElement)
The query getNamesOfMember() is overridden to take account of importing. It gives back the set of names that an element would have in an importing namespace, either because it is owned, or if not owned then imported individually, or if not individually then from a package. result = if self.ownedMember->includes(element) then Set{}->include(element.name) else let elementImports: ElementImport = self.elementImport->select(ei | ei.importedElement = element) in if elementImports->notEmpty() then elementImports->collect(el | el.getName()) else self.packageImport->select(pi | pi.importedPackage.visibleMembers()->includes(element))->collect(pi | pi.importedPackage.getNamesOfMember(element)) endif endif
public ISetExpression<string> GetNamesOfMember(INamedElement element)
Parameters
element
INamedElement
Returns
GetRelativePathForNonIdentifiedChild(IModelElement)
Gets the relative URI fragment for the given child model element
protected override string GetRelativePathForNonIdentifiedChild(IModelElement element)
Parameters
element
IModelElementThe element that should be looked for
Returns
- string
A fragment of the relative URI
GetType()
If this operation has a return parameter, type equals the value of type for that parameter. Otherwise type is not defined. result = if returnResult->size() = 1 then returnResult->any().type else Set{} endif
public IType GetType()
Returns
ImportMembers(IEnumerable<IPackageableElement>)
The query importMembers() defines which of a set of PackageableElements are actually imported into the namespace. This excludes hidden ones, i.e., those which have names that conflict with names of owned members, and also excludes elements which would have the same name when imported. result = self.excludeCollisions(imps)->select(imp | self.ownedMember->forAll(mem | mem.imp.isDistinguishableFrom(mem, self)))
public ISetExpression<IPackageableElement> ImportMembers(IEnumerable<IPackageableElement> imps)
Parameters
Returns
IncludesCardinality(int)
The query includesCardinality() checks whether the specified cardinality is valid for this multiplicity. upperBound()->notEmpty() and lowerBound()->notEmpty() result = (lowerBound() <= C) and (upperBound() >= C)
public bool IncludesCardinality(int c)
Parameters
c
int
Returns
IncludesMultiplicity(IMultiplicityElement)
The query includesMultiplicity() checks whether this multiplicity includes all the cardinalities allowed by the specified multiplicity. self.upperBound()->notEmpty() and self.lowerBound()->notEmpty() and M.upperBound()->notEmpty() and M.lowerBound()->notEmpty() result = (self.lowerBound() <= M.lowerBound()) and (self.upperBound() >= M.upperBound())
public bool IncludesMultiplicity(IMultiplicityElement m)
Parameters
Returns
IsMultivalued()
The query isMultivalued() checks whether this multiplicity has an upper bound greater than one. upperBound()->notEmpty() result = upperBound() > 1
public bool IsMultivalued()
Returns
LowerBound()
The query lowerBound() returns the lower bound of the multiplicity as an integer. result = if lower->notEmpty() then lower else 1 endif
public int LowerBound()
Returns
Lower_ge_0(object, object)
The lower bound must be a non-negative integer literal. lowerBound()->notEmpty() implies lowerBound() >= 0
public bool Lower_ge_0(object diagnostics, object context)
Parameters
Returns
MembersAreDistinguishable()
The Boolean query membersAreDistinguishable() determines whether all of the namespace's members are distinguishable within it. result = self.member->forAll( memb | self.member->excluding(memb)->forAll(other | memb.isDistinguishableFrom(other, self)))
public bool MembersAreDistinguishable()
Returns
Members_are_distinguishable(object, object)
All the members of a Namespace are distinguishable within it. membersAreDistinguishable()
public bool Members_are_distinguishable(object diagnostics, object context)
Parameters
Returns
Only_body_for_query(object, object)
A bodyCondition can only be specified for a query operation. bodyCondition->notEmpty() implies isQuery
public bool Only_body_for_query(object diagnostics, object context)
Parameters
Returns
ReturnResult()
result = ownedParameter->select (par | par.direction = #return)
public ISetExpression<IParameter> ReturnResult()
Returns
SetFeature(string, object)
Sets a value to the given feature
protected override void SetFeature(string feature, object value)
Parameters
UpperBound()
The query upperBound() returns the upper bound of the multiplicity for a bounded multiplicity as an unlimited natural. result = if upper->notEmpty() then upper else 1 endif
public int UpperBound()
Returns
Upper_ge_lower(object, object)
The upper bound must be greater than or equal to the lower bound. (upperBound()->notEmpty() and lowerBound()->notEmpty()) implies upperBound() >= lowerBound()
public bool Upper_ge_lower(object diagnostics, object context)
Parameters
Returns
Upper_gt_0(object, object)
A multiplicity must define at least one valid cardinality that is greater than zero. upperBound()->notEmpty() implies upperBound() > 0
public bool Upper_gt_0(object diagnostics, object context)