-- $Id$ module MergeModel; create OUT : UML refining IN : UML, MERGE : UML; uses MergeHelpers; -- ====================================================================== -- merge helper variables begin -- ====================================================================== helper def : inElements : Set(UML!Element) = UML!Element.allInstancesFrom('IN'); helper def : mergeElements : Set(UML!Element) = UML!Element.allInstancesFrom('MERGE'); helper def : newElements : Sequence(UML!Element) = Sequence{ UML!Classifier.allInstancesFrom('MERGE')->select(c|c.notInSourceModel()), UML!Package.allInstancesFrom('MERGE')->select(p|p.notInSourceModel()), UML!TagDefinition.allInstancesFrom('MERGE')->select(t|t.notInSourceModel()), UML!Stereotype.allInstancesFrom('MERGE')->select(s|s.notInSourceModel()), UML!Association.allInstancesFrom('MERGE')->select(a|a.notInSourceModel()), UML!Dependency.allInstancesFrom('MERGE')->select(d|d.notInSourceModel()), UML!Generalization.allInstancesFrom('MERGE')->select(g|g.notInSourceModel()) }->flatten(); -- ====================================================================== -- merge helper variables end -- ====================================================================== -- ====================================================================== -- model merge begin -- ====================================================================== rule MergeAssociation { from s : UML!Association ( if thisModule.newElements->includes(s) then s.oclIsTypeOf(UML!Association) else false endif) to t : UML!Association mapsTo s ( isRoot <- s.isRoot, isAbstract <- s.isAbstract, visibility <- s.visibility, name <- s.name, isSpecification <- s.isSpecification, isLeaf <- s.isLeaf, comment <- s.comment, constraint <- s.constraint, stereotype <- s.stereotype->collect(e|if thisModule.newElements->includes(e) then e else e.fromSourceModel() endif), namespace <- if thisModule.newElements->includes(s.namespace) then s.namespace else s.namespace.fromSourceModel() endif) } rule MergeTaggedValue { from s : UML!TaggedValue ( if thisModule.mergeElements->includes(s) then s.notInSourceModel() else false endif) to t : UML!TaggedValue mapsTo s ( dataValue <- s.dataValue, visibility <- s.visibility, name <- s.name, isSpecification <- s.isSpecification, referenceValue <- s.referenceValue, modelElement <- s.modelElement, comment <- s.comment, constraint <- s.constraint, stereotype <- s.stereotype->collect(e|if thisModule.newElements->includes(e) then e else e.fromSourceModel() endif), clientDependency <- s.clientDependency, type <- if thisModule.newElements->includes(s.type) then s.type else s.type.fromSourceModel() endif) } rule MergeOperation { from s : UML!Operation ( if thisModule.mergeElements->includes(s) then s.notInSourceModel() else false endif) to t : UML!Operation mapsTo s ( owner <- if thisModule.newElements->includes(s.owner) then s.owner else s.owner.fromSourceModel() endif, parameter <- s.parameter, ownerScope <- s.ownerScope, visibility <- s.visibility, isQuery <- s.isQuery, isAbstract <- s.isAbstract, concurrency <- s.concurrency, name <- s.name, isSpecification <- s.isSpecification, isRoot <- s.isRoot, isLeaf <- s.isLeaf, specification <- s.specification, comment <- s.comment, constraint <- s.constraint, stereotype <- s.stereotype->collect(e|if thisModule.newElements->includes(e) then e else e.fromSourceModel() endif)) } rule MergeAbstraction { from s : UML!Abstraction ( thisModule.newElements->includes(s)) to t : UML!Abstraction mapsTo s ( mapping <- s.mapping, visibility <- s.visibility, name <- s.name, isSpecification <- s.isSpecification, comment <- s.comment, client <- s.client->collect(e|if thisModule.newElements->includes(e) then e else e.fromSourceModel() endif), constraint <- s.constraint, stereotype <- s.stereotype->collect(e|if thisModule.newElements->includes(e) then e else e.fromSourceModel() endif), supplier <- s.supplier->collect(e|if thisModule.newElements->includes(e) then e else e.fromSourceModel() endif), namespace <- if thisModule.newElements->includes(s.namespace) then s.namespace else s.namespace.fromSourceModel() endif) } rule MergeParameter { from s : UML!Parameter ( if thisModule.mergeElements->includes(s) then s.notInSourceModel() else false endif) to t : UML!Parameter mapsTo s ( kind <- s.kind, visibility <- s.visibility, name <- s.name, isSpecification <- s.isSpecification, defaultValue <- s.defaultValue, comment <- s.comment, type <- if thisModule.newElements->includes(s.type) then s.type else s.type.fromSourceModel() endif, constraint <- s.constraint, stereotype <- s.stereotype->collect(e|if thisModule.newElements->includes(e) then e else e.fromSourceModel() endif)) } rule MergeClass { from s : UML!Class ( if thisModule.newElements->includes(s) then s.oclIsTypeOf(UML!Class) else false endif) to t : UML!Class mapsTo s ( isRoot <- s.isRoot, isActive <- s.isActive, isAbstract <- s.isAbstract, visibility <- s.visibility, name <- s.name, isSpecification <- s.isSpecification, isLeaf <- s.isLeaf, comment <- s.comment, constraint <- s.constraint, stereotype <- s.stereotype->collect(e|if thisModule.newElements->includes(e) then e else e.fromSourceModel() endif), namespace <- if thisModule.newElements->includes(s.namespace) then s.namespace else s.namespace.fromSourceModel() endif) } rule MergeInterface { from s : UML!Interface ( thisModule.newElements->includes(s)) to t : UML!Interface mapsTo s ( isRoot <- s.isRoot, isAbstract <- s.isAbstract, visibility <- s.visibility, name <- s.name, isSpecification <- s.isSpecification, isLeaf <- s.isLeaf, comment <- s.comment, constraint <- s.constraint, stereotype <- s.stereotype->collect(e|if thisModule.newElements->includes(e) then e else e.fromSourceModel() endif), namespace <- if thisModule.newElements->includes(s.namespace) then s.namespace else s.namespace.fromSourceModel() endif) } rule MergeDataType { from s : UML!DataType ( if thisModule.newElements->includes(s) then s.oclIsTypeOf(UML!DataType) else false endif) to t : UML!DataType mapsTo s ( isRoot <- s.isRoot, isAbstract <- s.isAbstract, visibility <- s.visibility, name <- s.name, isSpecification <- s.isSpecification, isLeaf <- s.isLeaf, comment <- s.comment, constraint <- s.constraint, stereotype <- s.stereotype->collect(e|if thisModule.newElements->includes(e) then e else e.fromSourceModel() endif), namespace <- if thisModule.newElements->includes(s.namespace) then s.namespace else s.namespace.fromSourceModel() endif) } rule MergeComponent { from s : UML!Component( thisModule.newElements->includes(s)) to t : UML!Component mapsTo s ( isSpecification <- s.isSpecification, visibility <- s.visibility, name <- s.name, isAbstract <- s.isAbstract, isLeaf <- s.isLeaf, isRoot <- s.isRoot, constraint <- s.constraint, comment <- s.comment, stereotype <- s.stereotype->collect(e|if thisModule.newElements->includes(e) then e else e.fromSourceModel() endif), namespace <- if thisModule.newElements->includes(s.namespace) then s.namespace else s.namespace.fromSourceModel() endif) } rule MergePackage { from s : UML!Package ( if thisModule.newElements->includes(s) then s.oclIsTypeOf(UML!Package) else false endif) to t : UML!Package mapsTo s ( isRoot <- s.isRoot, isAbstract <- s.isAbstract, visibility <- s.visibility, name <- s.name, isSpecification <- s.isSpecification, isLeaf <- s.isLeaf, comment <- s.comment, constraint <- s.constraint, stereotype <- s.stereotype->collect(e|if thisModule.newElements->includes(e) then e else e.fromSourceModel() endif), namespace <- if thisModule.newElements->includes(s.namespace) then s.namespace else s.namespace.fromSourceModel() endif) } rule MergeAssociationEnd { from s : UML!AssociationEnd ( if thisModule.mergeElements->includes(s) then if s.oclIsTypeOf(UML!AssociationEnd) then s.notInSourceModel() else false endif else false endif) to t : UML!AssociationEnd mapsTo s ( association <- s.association, targetScope <- s.targetScope, isNavigable <- s.isNavigable, ordering <- s.ordering, changeability <- s.changeability, multiplicity <- s.multiplicity, aggregation <- s.aggregation, visibility <- s.visibility, name <- s.name, isSpecification <- s.isSpecification, qualifier <- s.qualifier, participant <- if thisModule.newElements->includes(s.participant) then s.participant else s.participant.fromSourceModel() endif, comment <- s.comment, constraint <- s.constraint, specification <- s.specification->collect(e|if thisModule.newElements->includes(e) then e else e.fromSourceModel() endif), stereotype <- s.stereotype->collect(e|if thisModule.newElements->includes(e) then e else e.fromSourceModel() endif)) } rule MergeAttribute { from s : UML!Attribute ( if thisModule.mergeElements->includes(s) then s.notInSourceModel() else false endif) to t : UML!Attribute mapsTo s ( owner <- if thisModule.newElements->includes(s.owner) then s.owner else s.owner.fromSourceModel() endif, targetScope <- s.targetScope, initialValue <- s.initialValue, ownerScope <- s.ownerScope, visibility <- s.visibility, changeability <- s.changeability, ordering <- s.ordering, name <- s.name, isSpecification <- s.isSpecification, multiplicity <- s.multiplicity, comment <- s.comment, constraint <- s.constraint, stereotype <- s.stereotype->collect(e|if thisModule.newElements->includes(e) then e else e.fromSourceModel() endif), type <- if thisModule.newElements->includes(s.type) then s.type else s.type.fromSourceModel() endif) } rule MergeGeneralization { from s : UML!Generalization ( thisModule.newElements->includes(s)) to t : UML!Generalization mapsTo s ( discriminator <- s.discriminator, visibility <- s.visibility, name <- s.name, isSpecification <- s.isSpecification, templateParameter <- s.templateParameter, comment <- s.comment, powertype <- if s.powertype.oclIsUndefined() then s.powertype else if thisModule.newElements->includes(s.powertype) then s.powertype else s.powertype.fromSourceModel() endif endif, parent <- if thisModule.newElements->includes(s.parent) then s.parent else s.parent.fromSourceModel() endif, constraint <- s.constraint, stereotype <- s.stereotype->collect(e|if thisModule.newElements->includes(e) then e else e.fromSourceModel() endif), child <- if thisModule.newElements->includes(s.child) then s.child else s.child.fromSourceModel() endif, namespace <- if thisModule.newElements->includes(s.namespace) then s.namespace else s.namespace.fromSourceModel() endif) } rule MergeDependency { from s : UML!Dependency ( if thisModule.newElements->includes(s) then s.oclIsTypeOf(UML!Dependency) else false endif) to t : UML!Dependency mapsTo s ( visibility <- s.visibility, name <- s.name, isSpecification <- s.isSpecification, comment <- s.comment, client <- s.client->collect(e|if thisModule.newElements->includes(e) then e else e.fromSourceModel() endif), constraint <- s.constraint, stereotype <- s.stereotype->collect(e|if thisModule.newElements->includes(e) then e else e.fromSourceModel() endif), supplier <- s.supplier->collect(e|if thisModule.newElements->includes(e) then e else e.fromSourceModel() endif), namespace <- if thisModule.newElements->includes(s.namespace) then s.namespace else s.namespace.fromSourceModel() endif) } rule MergeTagDefinition { from s : UML!TagDefinition ( thisModule.newElements->includes(s)) to t : UML!TagDefinition mapsTo s ( owner <- if thisModule.newElements->includes(s.owner) then s.owner else s.owner.fromSourceModel() endif, tagType <- s.tagType, multiplicity <- s.multiplicity, visibility <- s.visibility, name <- s.name, isSpecification <- s.isSpecification, templateParameter <- s.templateParameter, comment <- s.comment, constraint <- s.constraint, stereotype <- s.stereotype->collect(e|if thisModule.newElements->includes(e) then e else e.fromSourceModel() endif), namespace <- if thisModule.newElements->includes(s.namespace) then s.namespace else s.namespace.fromSourceModel() endif) } rule MergeStereotype { from s : UML!Stereotype ( thisModule.newElements->includes(s)) to t : UML!Stereotype mapsTo s ( isRoot <- s.isRoot, isAbstract <- s.isAbstract, baseClass <- s.baseClass, visibility <- s.visibility, name <- s.name, icon <- s.icon, isSpecification <- s.isSpecification, isLeaf <- s.isLeaf, comment <- s.comment, constraint <- s.constraint, stereotype <- s.stereotype->collect(e|if thisModule.newElements->includes(e) then e else e.fromSourceModel() endif), stereotypeConstraint <- s.stereotypeConstraint, namespace <- if thisModule.newElements->includes(s.namespace) then s.namespace else s.namespace.fromSourceModel() endif) } rule MergeMethod { from s : UML!Method ( if thisModule.mergeElements->includes(s) then s.notInSourceModel() else false endif) to t : UML!Method mapsTo s ( owner <- if thisModule.newElements->includes(s.owner) then s.owner else s.owner.fromSourceModel() endif, body <- s.body, ownerScope <- s.ownerScope, visibility <- s.visibility, isQuery <- s.isQuery, name <- s.name, isSpecification <- s.isSpecification, comment <- s.comment, specification <- s.specification, constraint <- s.constraint, stereotype <- s.stereotype->collect(e|if thisModule.newElements->includes(e) then e else e.fromSourceModel() endif)) } rule MergeException { from s : UML!Exception ( thisModule.newElements->includes(s)) to t : UML!Exception mapsTo s ( isRoot <- s.isRoot, name <- s.name, isAbstract <- s.isAbstract, visibility <- s.visibility, isSpecification <- s.isSpecification, isLeaf <- s.isLeaf, "context" <- s."context"->collect(e|if e.notInSourceModel() then e else e.fromSourceModel() endif), constraint <- s.constraint, stereotype <- s.stereotype->collect(e|if thisModule.newElements->includes(e) then e else e.fromSourceModel() endif), comment <- s.comment, namespace <- if thisModule.newElements->includes(s.namespace) then s.namespace else s.namespace.fromSourceModel() endif) } -- ====================================================================== -- model merge end -- ====================================================================== -- ====================================================================== -- model copy begin -- ====================================================================== -- Generated by: ModelCopyGenerator.atl 1515 2005-06-15 14:41:07Z dwagelaa $ rule Model { from s : UML!Model ( thisModule.inElements->includes(s)) to t : UML!Model mapsTo s ( isLeaf <- s.isLeaf, isRoot <- s.isRoot, visibility <- s.visibility, name <- s.name, isSpecification <- s.isSpecification, isAbstract <- s.isAbstract, templateParameter <- s.templateParameter, elementImport <- s.elementImport, comment <- s.comment, ownedElement <- s.ownedElement, taggedValue <- s.taggedValue, clientDependency <- s.clientDependency, constraint <- s.constraint, targetFlow <- s.targetFlow, generalization <- s.generalization, stereotype <- s.stereotype, sourceFlow <- s.sourceFlow) } rule StateMachine { from s : UML!StateMachine (s.oclIsTypeOf(UML!StateMachine) and thisModule.inElements->includes(s)) to t : UML!StateMachine mapsTo s ( visibility <- s.visibility, name <- s.name, isSpecification <- s.isSpecification, templateParameter <- s.templateParameter, submachineState <- s.submachineState, comment <- s.comment, top <- s.top, taggedValue <- s.taggedValue, transitions <- s.transitions, clientDependency <- s.clientDependency, constraint <- s.constraint, targetFlow <- s.targetFlow, stereotype <- s.stereotype, sourceFlow <- s.sourceFlow, "context" <- s."context") } -- ====================================================================== -- model copy end -- ======================================================================