-- @atlcompiler atl2006 -- $Id: ATLCopy.atl 7416 2008-04-03 17:33:12Z dwagelaa $ -- Generated by: EModelCopyGenerator.atl 7412 2008-04-01 09:51:42Z dwagelaa module ATLCopy; create OUT : ATL from IN : ATL, SUPER : ATL; helper def: inElements : Set(ATL!"ATL::LocatedElement") = ATL!"ATL::LocatedElement".allInstancesFrom('IN')->reject(o | o.isOverridden() )->asSet()->union(ATL!"ATL::LocatedElement".allInstancesFrom('SUPER')->reject(s | if s.oclIsKindOf(ATL!"ATL::Rule") or s.oclIsKindOf(ATL!"ATL::Helper") then s.isOverriding() else false endif )); rule Unit { from s : ATL!"ATL::Unit" ( if thisModule.inElements->includes(s) then s.oclIsTypeOf(ATL!"ATL::Unit") else false endif ) to t : ATL!"ATL::Unit" ( location <- s.location, commentsBefore <- s.commentsBefore, commentsAfter <- s.commentsAfter, name <- s.name, libraries <- s.libraries ) } rule Library { from s : ATL!"ATL::Library" ( thisModule.inElements->includes(s) ) to t : ATL!"ATL::Library" ( location <- s.location, commentsBefore <- s.commentsBefore, commentsAfter <- s.commentsAfter, name <- s.name, libraries <- s.libraries, helpers <- s.helpers ) } rule Query { from s : ATL!"ATL::Query" ( thisModule.inElements->includes(s) ) to t : ATL!"ATL::Query" ( location <- s.location, commentsBefore <- s.commentsBefore, commentsAfter <- s.commentsAfter, name <- s.name, libraries <- s.libraries, body <- s.body, helpers <- s.helpers ) } -- ******************************** rules ************************************ rule Module { from s : ATL!"ATL::Module" ( thisModule.realInElements->includes(s) ) using { superElements : Sequence(ATL!"ATL::ModuleElement") = ATL!"ATL::Module".allInstancesFrom('SUPER')->collect(m | m.elements->select(e | not e.isOverriding() ) )->flatten(); superInModels : Sequence(ATL!"OCL::OclModel") = ATL!"ATL::Module".allInstancesFrom('SUPER')->collect(m | m.inModels )->flatten(); superOutModels : Sequence(ATL!"OCL::OclModel") = ATL!"ATL::Module".allInstancesFrom('SUPER')->collect(m | m.outModels )->flatten(); superLibraryRefs : Sequence(ATL!"ATL::LibraryRef") = ATL!"ATL::Module".allInstancesFrom('SUPER')->collect(m | m.libraries )->flatten(); } to t : ATL!"ATL::Module" ( location <- s.location, commentsBefore <- s.commentsBefore, commentsAfter <- s.commentsAfter, name <- s.name, isRefining <- s.isRefining, libraries <- s.libraries->union(superLibraryRefs), inModels <- s.inModels->union(superInModels), outModels <- s.outModels->union(superOutModels), elements <- s.elements->union(superElements) ) } rule Helper { from s : ATL!"ATL::Helper" ( thisModule.inElements->includes(s) ) to t : ATL!"ATL::Helper" ( location <- s.location, commentsBefore <- s.commentsBefore, commentsAfter <- s.commentsAfter, definition <- s.definition ) } rule MatchedRule { from s : ATL!"ATL::MatchedRule" ( if thisModule.inElements->includes(s) then s.oclIsTypeOf(ATL!"ATL::MatchedRule") else false endif ) to t : ATL!"ATL::MatchedRule" ( location <- s.location, commentsBefore <- s.commentsBefore, commentsAfter <- s.commentsAfter, name <- s.name, isAbstract <- s.isAbstract, isRefining <- s.isRefining, isNoDefault <- s.isNoDefault, outPattern <- s.outPattern, actionBlock <- s.actionBlock, variables <- s.variables, inPattern <- s.inPattern, children <- s.children, superRule <- s.superRule ) } rule LazyMatchedRule { from s : ATL!"ATL::LazyMatchedRule" ( thisModule.inElements->includes(s) ) to t : ATL!"ATL::LazyMatchedRule" ( location <- s.location, commentsBefore <- s.commentsBefore, commentsAfter <- s.commentsAfter, name <- s.name, isAbstract <- s.isAbstract, isRefining <- s.isRefining, isNoDefault <- s.isNoDefault, isUnique <- s.isUnique, outPattern <- s.outPattern, actionBlock <- s.actionBlock, variables <- s.variables, inPattern <- s.inPattern, children <- s.children, superRule <- s.superRule ) } rule CalledRule { from s : ATL!"ATL::CalledRule" ( thisModule.inElements->includes(s) ) to t : ATL!"ATL::CalledRule" ( location <- s.location, commentsBefore <- s.commentsBefore, commentsAfter <- s.commentsAfter, name <- s.name, isEntrypoint <- s.isEntrypoint, isEndpoint <- s.isEndpoint, outPattern <- s.outPattern, actionBlock <- s.actionBlock, variables <- s.variables, parameters <- s.parameters ) } rule InPattern { from s : ATL!"ATL::InPattern" ( thisModule.inElements->includes(s) ) to t : ATL!"ATL::InPattern" ( location <- s.location, commentsBefore <- s.commentsBefore, commentsAfter <- s.commentsAfter, elements <- s.elements, filter <- s.filter ) } rule OutPattern { from s : ATL!"ATL::OutPattern" ( thisModule.inElements->includes(s) ) to t : ATL!"ATL::OutPattern" ( location <- s.location, commentsBefore <- s.commentsBefore, commentsAfter <- s.commentsAfter, elements <- s.elements ) } rule SimpleInPatternElement { from s : ATL!"ATL::SimpleInPatternElement" ( thisModule.inElements->includes(s) ) to t : ATL!"ATL::SimpleInPatternElement" ( location <- s.location, commentsBefore <- s.commentsBefore, commentsAfter <- s.commentsAfter, id <- s.id, varName <- s.varName, type <- s.type, initExpression <- s.initExpression, variableExp <- s.variableExp, mapsTo <- s.mapsTo, models <- s.models ) } rule SimpleOutPatternElement { from s : ATL!"ATL::SimpleOutPatternElement" ( thisModule.inElements->includes(s) ) to t : ATL!"ATL::SimpleOutPatternElement" ( location <- s.location, commentsBefore <- s.commentsBefore, commentsAfter <- s.commentsAfter, id <- s.id, varName <- s.varName, type <- s.type, initExpression <- s.initExpression, variableExp <- s.variableExp, sourceElement <- s.sourceElement, bindings <- s.bindings, model <- s.model ) } rule ForEachOutPatternElement { from s : ATL!"ATL::ForEachOutPatternElement" ( thisModule.inElements->includes(s) ) to t : ATL!"ATL::ForEachOutPatternElement" ( location <- s.location, commentsBefore <- s.commentsBefore, commentsAfter <- s.commentsAfter, id <- s.id, varName <- s.varName, type <- s.type, initExpression <- s.initExpression, variableExp <- s.variableExp, sourceElement <- s.sourceElement, bindings <- s.bindings, model <- s.model, collection <- s.collection, iterator <- s.iterator ) } rule Binding { from s : ATL!"ATL::Binding" ( thisModule.inElements->includes(s) ) to t : ATL!"ATL::Binding" ( location <- s.location, commentsBefore <- s.commentsBefore, commentsAfter <- s.commentsAfter, propertyName <- s.propertyName, value <- s.value ) } rule RuleVariableDeclaration { from s : ATL!"ATL::RuleVariableDeclaration" ( thisModule.inElements->includes(s) ) to t : ATL!"ATL::RuleVariableDeclaration" ( location <- s.location, commentsBefore <- s.commentsBefore, commentsAfter <- s.commentsAfter, id <- s.id, varName <- s.varName, type <- s.type, initExpression <- s.initExpression, variableExp <- s.variableExp ) } rule LibraryRef { from s : ATL!"ATL::LibraryRef" ( thisModule.inElements->includes(s) ) to t : ATL!"ATL::LibraryRef" ( location <- s.location, commentsBefore <- s.commentsBefore, commentsAfter <- s.commentsAfter, name <- s.name ) } rule ActionBlock { from s : ATL!"ATL::ActionBlock" ( thisModule.inElements->includes(s) ) to t : ATL!"ATL::ActionBlock" ( location <- s.location, commentsBefore <- s.commentsBefore, commentsAfter <- s.commentsAfter, statements <- s.statements ) } rule ExpressionStat { from s : ATL!"ATL::ExpressionStat" ( thisModule.inElements->includes(s) ) to t : ATL!"ATL::ExpressionStat" ( location <- s.location, commentsBefore <- s.commentsBefore, commentsAfter <- s.commentsAfter, expression <- s.expression ) } rule BindingStat { from s : ATL!"ATL::BindingStat" ( thisModule.inElements->includes(s) ) to t : ATL!"ATL::BindingStat" ( location <- s.location, commentsBefore <- s.commentsBefore, commentsAfter <- s.commentsAfter, propertyName <- s.propertyName, source <- s.source, value <- s.value ) } rule IfStat { from s : ATL!"ATL::IfStat" ( thisModule.inElements->includes(s) ) to t : ATL!"ATL::IfStat" ( location <- s.location, commentsBefore <- s.commentsBefore, commentsAfter <- s.commentsAfter, condition <- s.condition, thenStatements <- s.thenStatements, elseStatements <- s.elseStatements ) } rule ForStat { from s : ATL!"ATL::ForStat" ( thisModule.inElements->includes(s) ) to t : ATL!"ATL::ForStat" ( location <- s.location, commentsBefore <- s.commentsBefore, commentsAfter <- s.commentsAfter, iterator <- s.iterator, collection <- s.collection, statements <- s.statements ) } rule VariableExp { from s : ATL!"OCL::VariableExp" ( thisModule.inElements->includes(s) ) to t : ATL!"OCL::VariableExp" ( location <- s.location, commentsBefore <- s.commentsBefore, commentsAfter <- s.commentsAfter, type <- s.type, referredVariable <- s.referredVariable ) } rule SuperExp { from s : ATL!"OCL::SuperExp" ( thisModule.inElements->includes(s) ) to t : ATL!"OCL::SuperExp" ( location <- s.location, commentsBefore <- s.commentsBefore, commentsAfter <- s.commentsAfter, type <- s.type ) } rule StringExp { from s : ATL!"OCL::StringExp" ( thisModule.inElements->includes(s) ) to t : ATL!"OCL::StringExp" ( location <- s.location, commentsBefore <- s.commentsBefore, commentsAfter <- s.commentsAfter, stringSymbol <- s.stringSymbol, type <- s.type ) } rule BooleanExp { from s : ATL!"OCL::BooleanExp" ( thisModule.inElements->includes(s) ) to t : ATL!"OCL::BooleanExp" ( location <- s.location, commentsBefore <- s.commentsBefore, commentsAfter <- s.commentsAfter, booleanSymbol <- s.booleanSymbol, type <- s.type ) } rule RealExp { from s : ATL!"OCL::RealExp" ( thisModule.inElements->includes(s) ) to t : ATL!"OCL::RealExp" ( location <- s.location, commentsBefore <- s.commentsBefore, commentsAfter <- s.commentsAfter, realSymbol <- s.realSymbol, type <- s.type ) } rule IntegerExp { from s : ATL!"OCL::IntegerExp" ( thisModule.inElements->includes(s) ) to t : ATL!"OCL::IntegerExp" ( location <- s.location, commentsBefore <- s.commentsBefore, commentsAfter <- s.commentsAfter, integerSymbol <- s.integerSymbol, type <- s.type ) } rule BagExp { from s : ATL!"OCL::BagExp" ( thisModule.inElements->includes(s) ) to t : ATL!"OCL::BagExp" ( location <- s.location, commentsBefore <- s.commentsBefore, commentsAfter <- s.commentsAfter, type <- s.type, elements <- s.elements ) } rule OrderedSetExp { from s : ATL!"OCL::OrderedSetExp" ( thisModule.inElements->includes(s) ) to t : ATL!"OCL::OrderedSetExp" ( location <- s.location, commentsBefore <- s.commentsBefore, commentsAfter <- s.commentsAfter, type <- s.type, elements <- s.elements ) } rule SequenceExp { from s : ATL!"OCL::SequenceExp" ( thisModule.inElements->includes(s) ) to t : ATL!"OCL::SequenceExp" ( location <- s.location, commentsBefore <- s.commentsBefore, commentsAfter <- s.commentsAfter, type <- s.type, elements <- s.elements ) } rule SetExp { from s : ATL!"OCL::SetExp" ( thisModule.inElements->includes(s) ) to t : ATL!"OCL::SetExp" ( location <- s.location, commentsBefore <- s.commentsBefore, commentsAfter <- s.commentsAfter, type <- s.type, elements <- s.elements ) } rule TupleExp { from s : ATL!"OCL::TupleExp" ( thisModule.inElements->includes(s) ) to t : ATL!"OCL::TupleExp" ( location <- s.location, commentsBefore <- s.commentsBefore, commentsAfter <- s.commentsAfter, type <- s.type, tuplePart <- s.tuplePart ) } rule TuplePart { from s : ATL!"OCL::TuplePart" ( thisModule.inElements->includes(s) ) to t : ATL!"OCL::TuplePart" ( location <- s.location, commentsBefore <- s.commentsBefore, commentsAfter <- s.commentsAfter, id <- s.id, varName <- s.varName, type <- s.type, initExpression <- s.initExpression, variableExp <- s.variableExp ) } rule MapExp { from s : ATL!"OCL::MapExp" ( thisModule.inElements->includes(s) ) to t : ATL!"OCL::MapExp" ( location <- s.location, commentsBefore <- s.commentsBefore, commentsAfter <- s.commentsAfter, type <- s.type, elements <- s.elements ) } rule MapElement { from s : ATL!"OCL::MapElement" ( thisModule.inElements->includes(s) ) to t : ATL!"OCL::MapElement" ( location <- s.location, commentsBefore <- s.commentsBefore, commentsAfter <- s.commentsAfter, key <- s.key, value <- s.value ) } rule EnumLiteralExp { from s : ATL!"OCL::EnumLiteralExp" ( thisModule.inElements->includes(s) ) to t : ATL!"OCL::EnumLiteralExp" ( location <- s.location, commentsBefore <- s.commentsBefore, commentsAfter <- s.commentsAfter, name <- s.name, type <- s.type ) } rule OclUndefinedExp { from s : ATL!"OCL::OclUndefinedExp" ( thisModule.inElements->includes(s) ) to t : ATL!"OCL::OclUndefinedExp" ( location <- s.location, commentsBefore <- s.commentsBefore, commentsAfter <- s.commentsAfter, type <- s.type ) } rule NavigationOrAttributeCallExp { from s : ATL!"OCL::NavigationOrAttributeCallExp" ( thisModule.inElements->includes(s) ) to t : ATL!"OCL::NavigationOrAttributeCallExp" ( location <- s.location, commentsBefore <- s.commentsBefore, commentsAfter <- s.commentsAfter, name <- s.name, type <- s.type, source <- s.source ) } rule OperationCallExp { from s : ATL!"OCL::OperationCallExp" ( if thisModule.inElements->includes(s) then s.oclIsTypeOf(ATL!"OCL::OperationCallExp") else false endif ) to t : ATL!"OCL::OperationCallExp" ( location <- s.location, commentsBefore <- s.commentsBefore, commentsAfter <- s.commentsAfter, operationName <- s.operationName, type <- s.type, source <- s.source, arguments <- s.arguments ) } rule OperatorCallExp { from s : ATL!"OCL::OperatorCallExp" ( thisModule.inElements->includes(s) ) to t : ATL!"OCL::OperatorCallExp" ( location <- s.location, commentsBefore <- s.commentsBefore, commentsAfter <- s.commentsAfter, operationName <- s.operationName, type <- s.type, source <- s.source, arguments <- s.arguments ) } rule CollectionOperationCallExp { from s : ATL!"OCL::CollectionOperationCallExp" ( thisModule.inElements->includes(s) ) to t : ATL!"OCL::CollectionOperationCallExp" ( location <- s.location, commentsBefore <- s.commentsBefore, commentsAfter <- s.commentsAfter, operationName <- s.operationName, type <- s.type, source <- s.source, arguments <- s.arguments ) } rule IterateExp { from s : ATL!"OCL::IterateExp" ( thisModule.inElements->includes(s) ) to t : ATL!"OCL::IterateExp" ( location <- s.location, commentsBefore <- s.commentsBefore, commentsAfter <- s.commentsAfter, type <- s.type, source <- s.source, body <- s.body, iterators <- s.iterators, result <- s.result ) } rule IteratorExp { from s : ATL!"OCL::IteratorExp" ( thisModule.inElements->includes(s) ) to t : ATL!"OCL::IteratorExp" ( location <- s.location, commentsBefore <- s.commentsBefore, commentsAfter <- s.commentsAfter, name <- s.name, type <- s.type, source <- s.source, body <- s.body, iterators <- s.iterators ) } rule LetExp { from s : ATL!"OCL::LetExp" ( thisModule.inElements->includes(s) ) to t : ATL!"OCL::LetExp" ( location <- s.location, commentsBefore <- s.commentsBefore, commentsAfter <- s.commentsAfter, type <- s.type, variable <- s.variable, in_ <- s.in_ ) } rule IfExp { from s : ATL!"OCL::IfExp" ( thisModule.inElements->includes(s) ) to t : ATL!"OCL::IfExp" ( location <- s.location, commentsBefore <- s.commentsBefore, commentsAfter <- s.commentsAfter, type <- s.type, thenExpression <- s.thenExpression, condition <- s.condition, elseExpression <- s.elseExpression ) } rule VariableDeclaration { from s : ATL!"OCL::VariableDeclaration" ( if thisModule.inElements->includes(s) then s.oclIsTypeOf(ATL!"OCL::VariableDeclaration") else false endif ) to t : ATL!"OCL::VariableDeclaration" ( location <- s.location, commentsBefore <- s.commentsBefore, commentsAfter <- s.commentsAfter, id <- s.id, varName <- s.varName, type <- s.type, initExpression <- s.initExpression, variableExp <- s.variableExp ) } rule Iterator { from s : ATL!"OCL::Iterator" ( thisModule.inElements->includes(s) ) to t : ATL!"OCL::Iterator" ( location <- s.location, commentsBefore <- s.commentsBefore, commentsAfter <- s.commentsAfter, id <- s.id, varName <- s.varName, type <- s.type, initExpression <- s.initExpression, variableExp <- s.variableExp ) } rule Parameter { from s : ATL!"OCL::Parameter" ( thisModule.inElements->includes(s) ) to t : ATL!"OCL::Parameter" ( location <- s.location, commentsBefore <- s.commentsBefore, commentsAfter <- s.commentsAfter, id <- s.id, varName <- s.varName, type <- s.type, initExpression <- s.initExpression, variableExp <- s.variableExp ) } rule StringType { from s : ATL!"OCL::StringType" ( thisModule.inElements->includes(s) ) to t : ATL!"OCL::StringType" ( location <- s.location, commentsBefore <- s.commentsBefore, commentsAfter <- s.commentsAfter, name <- s.name, type <- s.type ) } rule BooleanType { from s : ATL!"OCL::BooleanType" ( thisModule.inElements->includes(s) ) to t : ATL!"OCL::BooleanType" ( location <- s.location, commentsBefore <- s.commentsBefore, commentsAfter <- s.commentsAfter, name <- s.name, type <- s.type ) } rule IntegerType { from s : ATL!"OCL::IntegerType" ( thisModule.inElements->includes(s) ) to t : ATL!"OCL::IntegerType" ( location <- s.location, commentsBefore <- s.commentsBefore, commentsAfter <- s.commentsAfter, name <- s.name, type <- s.type ) } rule RealType { from s : ATL!"OCL::RealType" ( thisModule.inElements->includes(s) ) to t : ATL!"OCL::RealType" ( location <- s.location, commentsBefore <- s.commentsBefore, commentsAfter <- s.commentsAfter, name <- s.name, type <- s.type ) } rule BagType { from s : ATL!"OCL::BagType" ( thisModule.inElements->includes(s) ) to t : ATL!"OCL::BagType" ( location <- s.location, commentsBefore <- s.commentsBefore, commentsAfter <- s.commentsAfter, name <- s.name, type <- s.type, elementType <- s.elementType ) } rule OrderedSetType { from s : ATL!"OCL::OrderedSetType" ( thisModule.inElements->includes(s) ) to t : ATL!"OCL::OrderedSetType" ( location <- s.location, commentsBefore <- s.commentsBefore, commentsAfter <- s.commentsAfter, name <- s.name, type <- s.type, elementType <- s.elementType ) } rule SequenceType { from s : ATL!"OCL::SequenceType" ( thisModule.inElements->includes(s) ) to t : ATL!"OCL::SequenceType" ( location <- s.location, commentsBefore <- s.commentsBefore, commentsAfter <- s.commentsAfter, name <- s.name, type <- s.type, elementType <- s.elementType ) } rule SetType { from s : ATL!"OCL::SetType" ( thisModule.inElements->includes(s) ) to t : ATL!"OCL::SetType" ( location <- s.location, commentsBefore <- s.commentsBefore, commentsAfter <- s.commentsAfter, name <- s.name, type <- s.type, elementType <- s.elementType ) } rule OclAnyType { from s : ATL!"OCL::OclAnyType" ( thisModule.inElements->includes(s) ) to t : ATL!"OCL::OclAnyType" ( location <- s.location, commentsBefore <- s.commentsBefore, commentsAfter <- s.commentsAfter, name <- s.name, type <- s.type ) } rule "TupleType" { from s : ATL!"OCL::TupleType" ( thisModule.inElements->includes(s) ) to t : ATL!"OCL::TupleType" ( location <- s.location, commentsBefore <- s.commentsBefore, commentsAfter <- s.commentsAfter, name <- s.name, type <- s.type, attributes <- s.attributes ) } rule TupleTypeAttribute { from s : ATL!"OCL::TupleTypeAttribute" ( thisModule.inElements->includes(s) ) to t : ATL!"OCL::TupleTypeAttribute" ( location <- s.location, commentsBefore <- s.commentsBefore, commentsAfter <- s.commentsAfter, name <- s.name, type <- s.type ) } rule OclModelElement { from s : ATL!"OCL::OclModelElement" ( thisModule.inElements->includes(s) ) to t : ATL!"OCL::OclModelElement" ( location <- s.location, commentsBefore <- s.commentsBefore, commentsAfter <- s.commentsAfter, name <- s.name, type <- s.type, model <- s.model.overriddenBy() ) } rule MapType { from s : ATL!"OCL::MapType" ( thisModule.inElements->includes(s) ) to t : ATL!"OCL::MapType" ( location <- s.location, commentsBefore <- s.commentsBefore, commentsAfter <- s.commentsAfter, name <- s.name, type <- s.type, valueType <- s.valueType, keyType <- s.keyType ) } rule OclFeatureDefinition { from s : ATL!"OCL::OclFeatureDefinition" ( thisModule.inElements->includes(s) ) to t : ATL!"OCL::OclFeatureDefinition" ( location <- s.location, commentsBefore <- s.commentsBefore, commentsAfter <- s.commentsAfter, feature <- s.feature, context_ <- s.context_ ) } rule OclContextDefinition { from s : ATL!"OCL::OclContextDefinition" ( thisModule.inElements->includes(s) ) to t : ATL!"OCL::OclContextDefinition" ( location <- s.location, commentsBefore <- s.commentsBefore, commentsAfter <- s.commentsAfter, context_ <- s.context_ ) } rule Attribute { from s : ATL!"OCL::Attribute" ( thisModule.inElements->includes(s) ) to t : ATL!"OCL::Attribute" ( location <- s.location, commentsBefore <- s.commentsBefore, commentsAfter <- s.commentsAfter, name <- s.name, initExpression <- s.initExpression, type <- s.type ) } rule Operation { from s : ATL!"OCL::Operation" ( thisModule.inElements->includes(s) ) to t : ATL!"OCL::Operation" ( location <- s.location, commentsBefore <- s.commentsBefore, commentsAfter <- s.commentsAfter, name <- s.name, parameters <- s.parameters, returnType <- s.returnType, body <- s.body ) } rule OclModel { from s : ATL!"OCL::OclModel" ( thisModule.inElements->includes(s) ) to t : ATL!"OCL::OclModel" ( location <- s.location, commentsBefore <- s.commentsBefore, commentsAfter <- s.commentsAfter, name <- s.name, metamodel <- s.metamodel, elements <- s.elements, model <- s.model ) } helper def: realInElements : Set(ATL!"ATL::LocatedElement") = ATL!"ATL::LocatedElement".allInstancesFrom('IN'); -- ***************************** isOverridden ******************************** -- ***************************** isOverridden ******************************** helper context ATL!"ATL::LocatedElement" def: isOverridden() : Boolean = let owner : ATL!"ATL::LocatedElement" = self.refImmediateComposite() in if owner.oclIsUndefined() then false else owner.isOverridden() endif; helper context ATL!"ATL::Rule" def: isOverridden() : Boolean = ATL!"ATL::Rule".allInstancesFrom('SUPER')->exists(r | r.name = self.name and r.oclType() = self.oclType() ); helper context ATL!"ATL::Helper" def: isOverridden() : Boolean = ATL!"ATL::Helper".allInstancesFrom('SUPER')->exists(r | r.definition.feature.name = self.definition.feature.name and r.definition.feature.oclType() = self.definition.feature.oclType() and if r.definition.context_.oclIsUndefined() or self.definition.context_.oclIsUndefined() then r.definition.context_ = self.definition.context_ else r.definition.context_.context_.name = self.definition.context_.context_.name endif ); helper context ATL!"OCL::VariableDeclaration" def: isOverridden() : Boolean = let owner : ATL!"ATL::LocatedElement" = self.refImmediateComposite() in let variableExpOverridden : Boolean = self.variableExp->exists(e | e.isOverridden() ) in if owner.oclIsUndefined() then variableExpOverridden else owner.isOverridden() or variableExpOverridden endif; helper context ATL!"OCL::OclModel" def: isOverridden() : Boolean = ATL!"OCL::OclModel".allInstancesFrom('SUPER')->exists(r | r.name = self.name and r.oclType() = self.oclType() ); helper context ATL!"ATL::LibraryRef" def: isOverridden() : Boolean = ATL!"ATL::LibraryRef".allInstancesFrom('SUPER')->exists(r | r.name = self.name and r.oclType() = self.oclType() ); -- ***************************** isOverriding ******************************** -- ***************************** isOverriding ******************************** helper context ATL!"ATL::LocatedElement" def: isOverriding() : Boolean = let owner : ATL!"ATL::LocatedElement" = self.refImmediateComposite() in if owner.oclIsUndefined() then false else owner.isOverriding() endif; helper context ATL!"ATL::Rule" def: isOverriding() : Boolean = ATL!"ATL::Rule".allInstancesFrom('IN')->exists(r | r.name = self.name and r.oclType() = self.oclType() ); helper context ATL!"ATL::Helper" def: isOverriding() : Boolean = ATL!"ATL::Helper".allInstancesFrom('IN')->exists(r | r.definition.feature.name = self.definition.feature.name and r.definition.feature.oclType() = self.definition.feature.oclType() and if r.definition.context_.oclIsUndefined() or self.definition.context_.oclIsUndefined() then r.definition.context_ = self.definition.context_ else r.definition.context_.context_.name = self.definition.context_.context_.name endif ); helper context ATL!"OCL::OclModel" def: isOverriding() : Boolean = ATL!"OCL::OclModel".allInstancesFrom('IN')->exists(r | r.name = self.name and r.oclType() = self.oclType() ); helper context ATL!"ATL::LibraryRef" def: isOverriding() : Boolean = ATL!"ATL::LibraryRef".allInstancesFrom('IN')->exists(r | r.name = self.name and r.oclType() = self.oclType() ); -- ***************************** overriddenBy ******************************** -- ***************************** overriddenBy ******************************** helper context ATL!"ATL::Rule" def: overriddenBy() : ATL!"ATL::Rule" = let selfInSuper : Sequence(ATL!"ATL::Rule") = ATL!"ATL::Rule".allInstancesFrom('SUPER')->select(r | r.name = self.name and r.oclType() = self.oclType() ) in if selfInSuper->isEmpty() then self else selfInSuper->first() endif; helper context ATL!"ATL::Helper" def: overriddenBy() : ATL!"ATL::Helper" = let selfInSuper : Sequence(ATL!"ATL::Helper") = ATL!"ATL::Helper".allInstancesFrom('SUPER')->select(r | r.definition.feature.name = self.definition.feature.name and r.definition.feature.oclType() = self.definition.feature.oclType() and if r.definition.context_.oclIsUndefined() or self.definition.context_.oclIsUndefined() then r.definition.context_ = self.definition.context_ else r.definition.context_.context_.name = self.definition.context_.context_.name endif ) in if selfInSuper->isEmpty() then self else selfInSuper->first() endif; helper context ATL!"OCL::OclModel" def: overriddenBy() : ATL!"OCL::OclModel" = let selfInSuper : Sequence(ATL!"OCL::OclModel") = ATL!"OCL::OclModel".allInstancesFrom('SUPER')->select(r | r.name = self.name and r.oclType() = self.oclType() ) in if selfInSuper->isEmpty() then self else selfInSuper->first() endif; -- ******************************** rules ************************************ rule OverriddenMatchedRule { from s : ATL!"ATL::MatchedRule" ( if thisModule.realInElements->includes(s) then s.oclIsTypeOf(ATL!"ATL::MatchedRule") and s.isOverridden() else false endif ) using { o : ATL!"ATL::MatchedRule" = s.overriddenBy(); } to t : ATL!"ATL::MatchedRule" ( location <- o.location, commentsBefore <- o.commentsBefore, commentsAfter <- o.commentsAfter, name <- o.name, isAbstract <- o.isAbstract, isRefining <- o.isRefining, isNoDefault <- o.isNoDefault, outPattern <- o.outPattern, actionBlock <- o.actionBlock, variables <- o.variables, inPattern <- o.inPattern, children <- o.children, superRule <- o.superRule ) } rule OverriddenLazyMatchedRule { from s : ATL!"ATL::LazyMatchedRule" ( if thisModule.realInElements->includes(s) then s.isOverridden() else false endif ) using { o : ATL!"ATL::LazyMatchedRule" = s.overriddenBy(); } to t : ATL!"ATL::LazyMatchedRule" ( location <- o.location, commentsBefore <- o.commentsBefore, commentsAfter <- o.commentsAfter, name <- o.name, isAbstract <- o.isAbstract, isRefining <- o.isRefining, isNoDefault <- o.isNoDefault, isUnique <- o.isUnique, outPattern <- o.outPattern, actionBlock <- o.actionBlock, variables <- o.variables, inPattern <- o.inPattern, children <- o.children, superRule <- o.superRule ) } rule OverriddenCalledRule { from s : ATL!"ATL::CalledRule" ( if thisModule.realInElements->includes(s) then s.isOverridden() else false endif ) using { o : ATL!"ATL::CalledRule" = s.overriddenBy(); } to t : ATL!"ATL::CalledRule" ( location <- o.location, commentsBefore <- o.commentsBefore, commentsAfter <- o.commentsAfter, name <- o.name, isEntrypoint <- o.isEntrypoint, isEndpoint <- o.isEndpoint, outPattern <- o.outPattern, actionBlock <- o.actionBlock, variables <- o.variables, parameters <- o.parameters ) } rule OverriddenHelper { from s : ATL!"ATL::Helper" ( if thisModule.realInElements->includes(s) then s.isOverridden() else false endif ) using { o : ATL!"ATL::MatchedRule" = s.overriddenBy(); } to t : ATL!"ATL::Helper" ( location <- o.location, commentsBefore <- o.commentsBefore, commentsAfter <- o.commentsAfter, definition <- o.definition ) }