|
The VariableDeclarations that represents the iterator variables. These variables are, each in its turn, bound to every element value of the source collection while evaluating the body expression. |
|
The OclExpression that is evaluated for each element in the source collection. |
|
The property that is applied to the instance that results from evaluating this OclExpression. |
|
The type of the value that is the result of evaluating the OclExpression. |
|
The OperationCallExp where this OclExpression is an argument of. See Figure 9 . |
|
The variable of which the result of this expression is the initial value. |
|
The OclExpression that represents the initial value of the variable. Depending on the role that a variable declaration plays, the init expression might be mandatory. |
|
The Classifier which represents the type of the variable. |
|
The VariableDeclaration to which this variable expression refers. In the case of a self expression the variable declaration is the definition of the self variable. |
|
The AssociationEnd to which this AssociationEndCallExp is a reference. This refers to an AssociationEnd of an Association that is defined in the UML model. |
|
The AssociationClass to which this AssociationClassCallExp is a reference. This refers to an AssociationClass that is defined in the UML model. |
|
The values for the qualifier attributes if applicable. |
|
The source denotes the AssociationEnd at the end of the object itself. This is used to resolve ambiguities when the same Classifier participates in more than one Association-End in the same association. In other cases it can be derived. |
|
The OclExpression that represents the boolean condition. If this condition evaluates to true, the result of the if expression is identical to the result of the thenExpression. If this condition evaluates to false, the result of the if expression is identical to the result of the elseExpression |
|
The OclExpression that represents the then part of the if expression. |
|
The OclExpression that represents the else part of the if expression. |
|
The OclExpression that represents the target instance to which the signal is sent. |
|
The SignalArgs that represents the parameters to the Operation or Signal. The number and type of arguments should conform to those defined in the Operation or Signal. The order of the arguments is the same as the order of the parameters of the Operation or the attributes of a Signal. |
|
If this is a message to request an operation call, this is the requested CallAction. |
|
If this is a UML signal sent, this is the SendAction. |
context AttrubuteCallExp
inv: type = referredAttribute.type
BooleanLiteralExpcontext BooleanLiteralExp
inv: self.type.name = 'Boolean'
context CollectionLiteralExp
inv: kind <> CollectionKind::Collection
context CollectionLiteralExp
inv: kind = CollectionKind::Set implies type.oclIsKindOf (SetType )
inv: kind = CollectionKind::Sequence implies type.oclIsKindOf
(SequenceType)
inv: kind = CollectionKind::Bag implies type.oclIsKindOf (BagType )
inv: type.oclAsType (CollectionType).elementType = parts->iterate
(p; c : Classifier = OclVoid | c.commonSuperType (p.type))
context CollectionItem
inv: type = item.type
context CollectionRange
inv: type = first.type.commonSuperType (last.type)
context EnumLiteralExp
inv: self.type = referredEnumLiteral.enumeration
context IfExp
inv: self.condition.type.oclIsKindOf(Primitive) and
self.condition.type.name = 'Boolean'
context IfExp
inv: self.type =
thenExpression.type.commonSuperType(elseExpression.type)
context IntegerLiteralExp
inv: self.type.name = 'Integer'
context IteratorExp
inv: name = 'exists' or name = 'forAll' or name = 'isUnique'
implies type.oclIsKindOf(Primitive) and type.name =
'Boolean'
context IteratorExp
inv: name = 'collect' implies
if source.type.oclIsKindOf(SequenceType) then
type =
expression.type.collectionType->select(oclIsTypeOf(SequenceType))->first()
else
type =
expression.type.collectionType->select(oclIsTypeOf(BagType))->first()
endif
context IteratorExp
inv: name = 'select' or name = 'reject' implies type = source.type
context IteratorExp
inv: name = 'exists' or name = 'forAll' or name = 'select' or name =
'reject'
implies body.type.name = 'Boolean'
context IterateExp
inv: type = result.type
body.type.conformsTo(result.type)
context IterateExp
inv: self.result.initExpression->size() = 1
context
LetExp
inv: type = in.type
context LoopExp
inv: source.type.oclIsKindOf (CollectionType)
context LoopExp
inv: self.iterators->forAll(initExpression->isEmpty())
context IteratorExp
inv: self.iterators->forAll(type = source.type.oclAsType
(CollectionType).elementType)
context OclMessageArg
inv: expression->size() + unspecified->size() = 1
context OclMessageExp
inv: calledOperation->notEmpty() implies
arguments->forall (a | a.getType().conformsTo
(self.calledOperation.operation.parameter->
select( kind =
ParameterDirectionKind::in )
->at (arguments->indexOf (a)).type))
context OclMessageExp
inv: sentSignal->notEmpty() implies
arguments->forall (a | a.getType().conformsTo
(self.sentSignal.signal.feature.oclAsType(StructuralFeature) )
->at
(arguments->indexOf (a)).type))
context OclMessageExp
inv: calledOperation->notEmpty() implies
target.type.allOperations()->includes(calledOperation.operation)
context OclMessageExp
inv: calledOperation->size() + sentMessage->size() = 1
context OclMessageExp
inv: not target.type.oclIsKindOf (CollectionType)
context OperationCallExp
inv: arguments->forall (a | a.type.conformsTo
(self.refParams->at (arguments->indexOf
(a)).type))
context OperationCallExp
inv: arguments->size() = refParams->size()
context OperationCallExp
def: refParams: Sequence(Parameter) =
referredOperation.parameters->select (p |
p.kind <> ParameterDirectionKind::return or
p.kind <> ParameterDirectionKind::out)
context RealLiteralExp
inv: self.type.name = 'Real'
context StringLiteralExp
inv: self.type.name = 'String'
context TupleLiteralExp
inv: type.oclIsKindOf (TupleType)
and
tuplePart->forAll (tlep |
type.oclAsType
(TupleType).allAttributes()->exists (tp | tlep.attribute = tp))
and
tuplePart->size() =
type.oclAsType (TupleType).allAttributes()->size()
context TupleLiteralExp
inv: tuplePart->isUnique (attribute.name)
context TupleLiteralExpPart
inv: attribute.type = value.type
context VariableDeclaration
inv: initExpression->notEmpty() implies
initExpression.type.conformsTo (type)
context VariableExp
inv: type = referredVariable.type
context Classifier
def: commonSuperType (c : Classifier) : Classifier =
Classifier.allInstances()->select (cst |
c.conformsTo (cst) and
self.conformsTo (cst) and
not
Classifier.allInstances()->exists (clst |
c.conformsTo
(clst) and
self.conformsTo (clst) and
clst.conformsTo (cst) and
clst <>
cst
)
)->any (true)
The following operations have been added to Classifier to lookup
attributes, associationEnds and operations.context Classifier
def: lookupAttribute(attName : String) : Attribute =
self.allAttributes->any(me | me.name = attName)
def: lookupAssociationEnd(name : String) : AssociationEnd =
self.allAssociationEnds->any (ae | ae.name = name)
def: lookupAssociationClass(name : String) : AssociationClass =
self.allAssociationClasses->any (ae | ae.name =
name)
def: lookupOperation (name: String, paramTypes: Sequence(Classifier)):
Operation =
self.allOperations->any (op | op.name = name and
op.hasMatchingSignature(paramTypes))
def: lookupSignal (sigName: String, paramTypes: Sequence(Classifier)):
Operation =
self.allReceptions.signal->any (sig | sig.name =
sigName and
sig.hasMatchingSignature(paramTypes))
context Classifier
def: allReceptions : set(Reception) =
self.allFeatures->select(f |
f.oclIsKindOf(Reception))
Operationcontext Operation
def: hasMatchingSignature(paramTypes: Sequence(Classifier)) : Boolean =
-- check that operation op has a signature
that matches the given
parameter lists
= let sigParamTypes:
Sequence(Classifier) = self.allAttributes.type in
(
(
sigParamTypes->size() = paramTypes->size() ) and
(
Set{1..paramTypes->size()}->forAll ( i |
paramTypes->at (i).conformsTo
(sigParamTypes->at (i))
)
)
)
Parametercontext Parameter::asAttribute(): Attribute
pre: -- none
post: result.name = self.name
post: result.type = self.type
post: result.multiplicity = 1
post: result.targetscope = ScopeKind::instance
post: result.ownerscope = ScopeKind::instance
post: result.ordering = OrderingKind::unordered
post: result.visibility = VisibilityKind::private
post: result.stereotype.name = 'OclHelper'
An additional class operation is added to Parameter to return a
Parameter. context Parameter::make(n : String, c : Classifier, k :
ParameterDirectionKind) :Parameter
post: result.name = n
post: result.kind = k
post: result.type = c
post: result.stereotype.name = 'OclHelper'
Signalcontext Signal
def: hasMatchingSignature(paramTypes: Sequence(Classifier)) : Boolean =
-- check that signal has a signature that matches
the given parameter
lists
= let opParamTypes: Sequence(Classifier) =
self.parameter->select (p
| p.kind <>
ParameterDirectionKind::return).type in
(
(
opParamTypes->size() = paramTypes->size() ) and
(
Set{1..paramTypes->size()}->forAll ( i |
paramTypes->at (i).conformsTo
(opParamTypes->at (i))
)
)
)
Statecontext State::getStateMachine() : StateMachine
post: result =
if statemachine->notEmpty() then
stateMachine
else
-- must be part of a composite
state
state.container.getStateMachine()
endif
Transitioncontext Transition::getStateMachine() : StateMachine
post: result =
if statemachine->notEmpty() then
stateMachine
else
-- state is not empty
state.getStateMachine()
endif
OclExpression::withAtPre() : OperationCallExp
post: result.name = 'atPre'
post: result.arguments->isEmpty()
post: result.source = self
The following operation returns an operation call expression for
the
predefined asSet() operation with the self expression as
its source.OclExpression::withAsSet() : OperationCallExp
post: result.name = 'asSet'
post: result.arguments->isEmpty()
post: result.source = self
OclMessageArgcontext OclMessageArg
def: getType() : Classifier = if unspecified->notEmpty()
then unspecified.type
else expression.type
endif
context TupleType::make(atts : sequence(Attribute) ) : TupleType
post: result.features = atts
post: result.stereotype.name = 'OclHelper'
VariableDeclarationcontext VariableDeclaration::asParameter() : Parameter
post: result.name = self.varName
post: result.kind = ParameterKind::in
post: result.type = self.type
An additional operation is added to VariableDeclaration to return a
corresponding Attribute.
context VariableDeclaration::asAttribute() : Attribute
post: result.name = self.varName
post: result.type = self.type
post: result.multiplicity = 1
post: result.targetscope = ScopeKind::instance
post: result.ownerscope = ScopeKind::instance
post: result.ordering = OrderingKind::unordered
post: result.visibility = VisibilityKind::private
post: result.constraint.bodyExpression = self.initExpression
post: result.stereotype.name = 'OclHelper'