summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorghillairet2012-05-09 10:01:46 (EDT)
committer mgolubev2012-05-09 10:01:46 (EDT)
commit79a451c9d5e5e33e8e465bc634b4d3805625efdb (patch)
tree26024bec4b112702acc69edf614e5fd3f84331dd
parent8ad06b94cf149d9a2e5c34f444e92cb1b3a6c305 (diff)
downloadorg.eclipse.gmf-tooling-79a451c9d5e5e33e8e465bc634b4d3805625efdb.zip
org.eclipse.gmf-tooling-79a451c9d5e5e33e8e465bc634b4d3805625efdb.tar.gz
org.eclipse.gmf-tooling-79a451c9d5e5e33e8e465bc634b4d3805625efdb.tar.bz2
removed for this release
-rw-r--r--plugins/org.eclipse.gmf.bridge/transforms/migration/Diff2Qvt.qvto337
-rw-r--r--plugins/org.eclipse.gmf.bridge/transforms/printer/qvtoprinter.qvto519
-rw-r--r--plugins/org.eclipse.gmf.bridge/transforms/util/GmfGenUtil.qvto29
-rw-r--r--plugins/org.eclipse.gmf.bridge/transforms/util/TraceUtil.qvto75
4 files changed, 0 insertions, 960 deletions
diff --git a/plugins/org.eclipse.gmf.bridge/transforms/migration/Diff2Qvt.qvto b/plugins/org.eclipse.gmf.bridge/transforms/migration/Diff2Qvt.qvto
deleted file mode 100644
index d81bd3d..0000000
--- a/plugins/org.eclipse.gmf.bridge/transforms/migration/Diff2Qvt.qvto
+++ /dev/null
@@ -1,337 +0,0 @@
-/**
-* Copyright (c) 2011, 2012 Montages A.G.
-* All rights reserved. This program and the accompanying materials
-* are made available under the terms of the Eclipse Public License v1.0
-* which accompanies this distribution, and is available at
-* http://www.eclipse.org/legal/epl-v10.html
-*
-* Contributors:
-* Guillaume Hillairet (Montages A.G.) : initial implementation
-*/
-modeltype DIFF uses diff('http://www.eclipse.org/emf/compare/diff/1.1');
-modeltype QVT uses qvtoperational::expressions('http://www.eclipse.org/QVT/1.0.0/Operational');
-modeltype ECORE uses ecore('http://www.eclipse.org/emf/2002/Ecore');
-modeltype OCL uses ocl('http://www.eclipse.org/ocl/1.1.0/OCL');
-modeltype IMP uses eimpocl("http://www.eclipse.org/qvt/1.0/ImperativeOCL");
-modeltype GMFGEN uses gmfgen('http://www.eclipse.org/gmf/2009/GenModel');
-
-transformation Diff2Qvt(in diffModel: DIFF, in gmfGen: ECORE, in oclStdLib: ECORE, in stdLib: ECORE, out qvtModel: QVT);
-
-property diff: DiffModel = null;
-property gmfGenParameter : ModelParameter = null;
-property setType: ocl::ecore::SetType = null;
-property bagType: ocl::ecore::BagType = null;
-
-main() {
- this.diff := diffModel.rootObjects()![DiffModel];
- this.diff.map toTransformation();
-}
-
--- ===========================================================================================================
--- Rules
--- ===========================================================================================================
-
-mapping DIFF::DiffModel::toTransformation(): OperationalTransformation {
- name := "GmfGenMigration";
- var genCommonBase = eObject('GenCommonBase');
- var genExternalNodeLabel = eObject('genExternalNodeLabel');
-
- moduleImport := object ModuleImport {
- importedModule := object Library {
- name := 'transforms.util.GmfGenUtil'
- }
- };
- var gmfGen := object ModelType {name := 'GMFGEN'; eSuperTypes := eClass('Model');
- _metamodel := ECORE::EPackage.allInstances()->any(e | e.nsURI = 'http://www.eclipse.org/gmf/2009/GenModel');
- };
- gmfGenParameter := object ModelParameter {
- name := 'gmfGenModel'; eType := gmfGen; kind := DirectionKind::_inout;
- };
- gmfGenParameter.representedParameter := gmfGenParameter.oclAsType(EObject);
- this.bagType := object ocl::ecore::BagType {
- name:='Bag(OclVoid)'; instanceClassName:='org.eclipse.ocl.util.Bag';elementType:= eObject('OclVoid');
- };
- this.setType := object ocl::ecore::SetType {
- name:='Set(GenChildNode)'; instanceClassName:='java.util.Set'; elementType:= genCommonBase;
- };
- modelParameter := gmfGenParameter;
-
- eClassifiers += gmfGen;
- eClassifiers += bagType;
- eClassifiers += setType;
-
- usedModelType += gmfGen;
- eSuperTypes += eClass('Transformation');
- entry := object EntryOperation {
- name := 'main';
- eType := eClass('OclVoid');
- body := object OperationBody {}
- };
- eOperations += entry;
- eOperations += DiffGroup.allInstances()->reject(subDiffElements->forAll(oclIsTypeOf(DiffGroup)))->map toMapping();
-}
-
-query DIFF::DiffElement::isCandidate(): Boolean = false;
-query DIFF::UpdateAttribute::isCandidate(): Boolean = true;
-query DIFF::ModelElementChangeRightTarget::isCandidate(): Boolean = true;
-query DIFF::ModelElementChangeLeftTarget::isCandidate(): Boolean = true;
-
-query DIFF::DiffGroup::isCandidate(): Boolean =
- let
- child = self.subDiffElements->reject(oclIsKindOf(DiffGroup))
- in
- child->notEmpty() and
- child->exists(isCandidate()) and
- (self.rightParent.hasID() or
- self.rightParent.eContainer().hasID() or
- self.rightParent.oclIsTypeOf(GenEditorGenerator) or
- self.rightParent.eContainer().oclIsTypeOf(GenEditorGenerator));
-
-query ECORE::EObject::getMappingName(objectID: EObject): String =
- self.eClass().name + objectID.ID().repr();
-
-mapping DIFF::DiffGroup::toMapping(): MappingOperation
- when {
- self.isCandidate()
- }{
-
- eType := eClass('OclVoid');
- context := object VarParameter {
- name := 'self';
- eType := self.rightParent.eClass();
- kind := DirectionKind::_inout;
- };
-
- if (self.rightParent.hasID()) then {
- name := self.rightParent.getMappingName(self.rightParent);
- _when := self.rightParent.createWhenObject(result);
- } else {
- if (self.rightParent.eContainer().hasID()) then {
- name := self.rightParent.getMappingName(self.rightParent.eContainer());
- _when := self.rightParent.eContainer().createWhenObjectContainer(result);
- } else {
- name := self.rightParent.eClass().name
- } endif;
- } endif;
-
- body := object ConstructorBody {
- content += self.subDiffElements->map toExpression(result)->reject(oclIsUndefined())->reject(oclIsInvalid())
- };
-
- this.diff.map toTransformation().addBodyContent(result, self.rightParent.eClass());
-}
-
-mapping DIFF::DiffElement::toExpression(op: MappingOperation): ocl::ecore::OCLExpression
- disjuncts
- DIFF::UpdateAttribute::toAssignExp,
- DIFF::ModelElementChangeRightTarget::toOperationCallExp,
- DIFF::ModelElementChangeLeftTarget::toOperationCallExp
- {}
-
-mapping DIFF::UpdateAttribute::toAssignExp(op: MappingOperation): AssignExp {
- isReset := true;
-
- switch {
- case (self.attribute.eAttributeType.oclIsTypeOf(EEnum)) {
- value := object ocl::ecore::EnumLiteralExp {
- referredEnumLiteral := self.rightElement.eGet(self.attribute).oclAsType(EObject);
- }
- };
- case ('EString' = self.attribute.eAttributeType.name) {
- value := object OCL::ecore::StringLiteralExp {
- stringSymbol := self.rightElement.eGet(self.attribute).repr();
- };
- };
- case (Set{'EInt', 'EInteger'}->includes(self.attribute.eAttributeType.name)) {
- value := object OCL::ecore::IntegerLiteralExp {
- integerSymbol := self.rightElement.eGet(self.attribute).repr().toInteger();
- };
- };
- case ('EDouble' = self.attribute.eAttributeType.name) {
- value := object OCL::ecore::RealLiteralExp {
- realSymbol := self.rightElement.eGet(self.attribute).repr().toReal();
- };
- };
- case ('EBoolean' = self.attribute.eAttributeType.name) {
- var val : Boolean = self.rightElement.eGet(self.attribute).repr() = 'true';
- value := object OCL::ecore::BooleanLiteralExp {
- booleanSymbol := val;
- };
- };
- else
- value := object OCL::ecore::StringLiteralExp {
- stringSymbol := self.rightElement.eGet(self.attribute).repr();
- };
- };
-
- left := object OCL::ecore::PropertyCallExp {
- eType := eClass('String');
- referredProperty := self.attribute.oclAsType(EObject);
- source := object OCL::ecore::VariableExp {
- name := 'self';
- referredVariable := op.context;
- eType := self.leftElement.eClass();
- }
- };
- eType := eClass('String');
-}
-
-mapping DIFF::ModelElementChangeRightTarget::toOperationCallExp(op: MappingOperation): ocl::ecore::OperationCallExp {
- init {
- var feature := self.rightElement.getContainingFeature();
- if not feature.oclIsUndefined() then
- if feature.many then {
- if self.rightElement.hasID() then {
- result := self.rightElement.createRemoveOpeartionCallManyElement(feature, op);
- } else {
- result := null;
- } endif;
- } else {
- result := self.rightElement.createRemoveOpeartionCallOneElement(feature, op);
- } endif
- else
- result := null
- endif;
- }
-}
-mapping DIFF::ModelElementChangeLeftTarget::toOperationCallExp(op: MappingOperation): ocl::ecore::OperationCallExp {
- init {
- var feature : EReference := self.leftElement.getContainingFeature();
- if not feature.oclIsUndefined() then
- if feature.many then {
- if self.leftElement.hasID() then {
- result := self.leftElement.createRemoveOpeartionCallManyElement(feature, op);
- } else result := null endif;
- } else {
- result := self.leftElement.createRemoveOpeartionCallOneElement(feature, op);
- } endif
- else result := null endif;
- }
-}
-
-helper ECORE::EObject::createRemoveOpeartionCallManyElement(feature: ECORE::EReference, op: MappingOperation): ocl::ecore::OperationCallExp {
- return object ocl::ecore::OperationCallExp {
- referredOperation := eOperation('Model', 'removeElement');
- argument := object ocl::ecore::OperationCallExp {
- name := 'node';
- argument := object ocl::ecore::PropertyCallExp {
- referredProperty := feature.oclAsType(EObject);
- upperBound := 1;
- source := object ocl::ecore::VariableExp {name:='self'; referredVariable := op.context};
- };
- argument += object ocl::ecore::IntegerLiteralExp {integerSymbol := self.ID().repr().toInteger()}
- };
- source := object ocl::ecore::VariableExp {referredVariable := gmfGenParameter}
- }
-}
-
-helper ECORE::EObject::createRemoveOpeartionCallOneElement(feature: ECORE::EReference, op: MappingOperation): ocl::ecore::OperationCallExp {
- return object ocl::ecore::OperationCallExp {
- referredOperation := eOperation('Model', 'removeElement');
- argument := object ocl::ecore::PropertyCallExp {
- referredProperty := feature.oclAsType(EObject);
- upperBound := 1;
- source := object ocl::ecore::VariableExp {name:='self'; referredVariable := op.context};
- };
- source := object ocl::ecore::VariableExp {referredVariable := gmfGenParameter}
- }
-}
-
--- ===========================================================================================================
--- Helpers
--- ===========================================================================================================
-
-helper eClass(type: String): EClass {
- return ECORE::EClass.allInstances()->any(e | e.name = type);
-}
-helper eObject(name: String): EObject {
- return ECORE::EClass.allInstances()->any(e | e.name = name).oclAsType(EObject);
-}
-helper eOperation(type: String, name: String): EObject {
- return eClass(type).eAllOperations->any(e | e.name = name).oclAsType(EObject)
-}
-
-helper EObject::hasID(): Boolean {
- var id := self.getID();
- return if not self.oclIsUndefined() then self.eIsSet(id) else false endif;
-}
-
-helper EObject::getID(): ECORE::EAttribute {
- var id := self.eClass().eIDAttribute;
- if id.oclIsUndefined() then
- id := self.eClass().eAllAttributes->any(_|_.name = 'visualID')
- endif;
- return id;
-}
-
-helper EObject::ID(): OclAny {
- return self.eGet(self.getID());
-}
-
--- self.visualID = 000
-helper ECORE::EObject::createWhenObject(op: MappingOperation): OCL::ecore::OperationCallExp =
- object OCL::ecore::OperationCallExp {
- eType := eClass('Boolean');
- referredOperation := eOperation('String_Class', '=');
- upperBound := 1;
- source := object OCL::ecore::PropertyCallExp {
- eType := eClass('Integer');
- upperBound := 1;
- name := self.getID().name;
- source := object OCL::ecore::VariableExp {
- name := 'self';
- upperBound := 1;
- referredVariable := op.context
- }
- };
- argument += object OCL::ecore::IntegerLiteralExp {
- upperBound := 1;
- integerSymbol:= self.oclAsType(GenCommonBase).visualID;
- }
- };
-
--- self.container().oclAsType(GenCommonBase).visualID = 000
-helper ECORE::EObject::createWhenObjectContainer(op: MappingOperation): OCL::ecore::OperationCallExp =
- object OCL::ecore::OperationCallExp {
- eType := eClass('Boolean');
- name := 'parentID';
- upperBound := 1;
- source := object OCL::ecore::VariableExp {
- name := 'self';
- upperBound := 1;
- referredVariable := op.context
- };
- argument += object OCL::ecore::IntegerLiteralExp {
- upperBound := 1;
- integerSymbol:= self.ID().repr().toInteger();
- }
- };
-
-helper OperationalTransformation::addBodyContent(op: MappingOperation, eClass: EClass) {
- self.entry.body.content += object ImperativeIterateExp {name := 'xcollect'; eType := bagType;
- source :=
- object ocl::ecore::OperationCallExp {
- eType := setType;
- referredOperation := eOperation('OclType_Class', 'allInstances');
- source :=
- object ocl::ecore::TypeExp {
- eType := eClass;
- referredType:= eClass.oclAsType(EObject)
- };
- };
- var tmp1 := object ocl::ecore::Variable {name:='e'; eType:= eClass};
- body := object MappingCallExp {
- eType := eClass('OclVoid');
- referredOperation := op.oclAsType(EObject);
- source := object ocl::ecore::VariableExp {
- name:= 'e';
- referredVariable:= tmp1;
- eType:= eClass
- }
- };
- iterator := tmp1;
- };
- return null;
-}
-
-helper ECORE::EObject::getContainingFeature(): ECORE::EReference = self.eContainingFeature().oclAsType(EReference);
diff --git a/plugins/org.eclipse.gmf.bridge/transforms/printer/qvtoprinter.qvto b/plugins/org.eclipse.gmf.bridge/transforms/printer/qvtoprinter.qvto
deleted file mode 100644
index ed45dc7..0000000
--- a/plugins/org.eclipse.gmf.bridge/transforms/printer/qvtoprinter.qvto
+++ /dev/null
@@ -1,519 +0,0 @@
-modeltype QVT uses qvtoperational::expressions('http://www.eclipse.org/QVT/1.0.0/Operational');
-modeltype ImpOCL uses ImperativeOCL('http://www.eclipse.org/qvt/1.0/ImperativeOCL');
-
-modeltype OCL uses 'http://www.eclipse.org/ocl/1.1.0/OCL';
-
-modeltype ECORE uses 'http://www.eclipse.org/emf/2002/Ecore';
-
-transformation Qvtprettyprinter(in qvtSrc : QVT, out string: ECORE);
-
-property _tab_ : String = ' ';
-
-main() {
- var s := qvtSrc.rootObjects()[OperationalTransformation]->asOrderedSet()->first();
-
- var _out = object ECORE::EStringToStringMapEntry {
- key := 'output';
- value := s.print(0);
- };
-}
-
-helper printTabs(tabs : Integer) : String {
- var i := 0;
- var code := '';
- while (i < tabs) {
- code := code + _tab_;
- i := i + 1;
- };
- return code;
-}
-
-helper printArgs(list : OrderedSet(ecore::EObject)) : String {
- if (list->isEmpty()) then
- return ""
- endif;
- var code : String := list->first().print(0);
- var rest := list->subOrderedSet(2, list->size());
- rest->forEach(expr) {
- code := code + ', ' + expr.print(0);
- };
- return code;
-}
-
-helper printArgs(list : OrderedSet(ecore::EModelElement)) : String {
- if (list->isEmpty()) then
- return ""
- endif;
- var code : String := list->first().print(0);
- var rest := list->subOrderedSet(2, list->size());
- rest->forEach(expr) {
- code := code + ', ' + expr.print(0);
- };
- return code;
-}
-
-
-helper printArgs(list : OrderedSet(ocl::utilities::ASTNode)) : String {
- if (list->isEmpty()) then
- return ""
- endif;
- var code : String := list->first().print(0);
- var rest := list->subOrderedSet(2, list->size());
- rest->forEach(expr) {
- code := code + ', ' + expr.print(0);
- };
- return code;
-}
-
-helper printExpressions(exprList : OrderedSet(ocl::ecore::OCLExpression), tabs : Integer) : String {
- var code : String;
- exprList->forEach(expr) {
- var val := expr.print(tabs);
-
- if val <> '' then { --notEmpty does not work here.
- code := code + printTabs(tabs) + val + ';\n'
- } endif;
- };
- return code;
-}
-
-helper ecore::EObject::print(tabs : Integer) : String {
- var nameFeature := self.eClass().getEStructuralFeature('name');
- return self.eGet(nameFeature).oclAsType(String);
-}
-
-helper ecore::EStructuralFeature::print(tabs : Integer) : String {
- var code : String := self.name;
- return code;
-}
-
-helper ecore::EModelElement::print(tabs : Integer) : String {
- assert(true);
- return "";
-}
-
-helper ocl::utilities::ASTNode::print(tabs : Integer) : String {
- assert(true);
- return "";
-}
-
-
-helper OperationalTransformation::print(tabs : Integer) : String {
- var code : String := "";
- self.moduleImport->forEach(m) {
- code := code + printTabs(tabs) + m.print(0);
- };
- self.usedModelType->forEach(mt) {
- code := code + printTabs(tabs) + mt.print(0);
- };
- code := code + '\n' + printTabs(tabs) + 'transformation ' + self.name + '(';
- code := code + printArgs(self.modelParameter);
-
- code := code + ');\n';
-
- self.configProperty->forEach(p) {
- code := code + '\nconfiguration property ' + p.name + ' : ' + p.eType.name + ';\n';
- };
-
- var set := self.eAllStructuralFeatures - self.configProperty;
-
- set->forEach(p|p.oclIsKindOf(EAttribute)) {
- var pa := p.oclAsType(EAttribute);
- code := code + '\nproperty ' + pa.name + ' : ' + pa.eType.name;
- code := code + ' = ' + pa.eAnnotations.contents->first().oclAsType(ocl::ecore::OCLExpression).print(0) + ';\n';
- };
-
- if not self.entry.oclIsInvalid() then {
- code := code + '\n' + self.entry.print(tabs);
- } endif;
-
- self.eOperations->forEach(op | op.oclIsKindOf(MappingOperation)) {
- if not op.oclIsInvalid() then {
- code := code + '\n' + op.oclAsType(MappingOperation).print(tabs);
- } endif;
- };
- self.eOperations->forEach(op | op.oclIsKindOf(Helper)) {
- code := code + '\n' + op.oclAsType(Helper).print(tabs);
- };
- return code;
-}
-
-helper ModuleImport::print(tabs: Integer): String {
- return 'import ' + self.importedModule.name + ';\n'
-}
-
-helper ModelType::print(tabs : Integer) : String {
- var code : String := 'modeltype ' + self.name;
- if (self.conformanceKind != null) then {
- code := code + ' "' + self.conformanceKind + '"';
- }
- endif;
- code := code + ' uses ';
- var package := self._metamodel->first();
- var meta : String := package.name;
- package := package.eSuperPackage;
- while (package != null) {
- meta := package.name + '::' + meta;
- package := package.eSuperPackage;
- };
- code := code + meta + '(' + self._metamodel->first().nsURI.quotify('\'') + ');' + '\n';
- return code;
-}
-
-helper ModelParameter::print(tabs : Integer) : String {
- var code : String := self.kind.repr() + ' ' + self.name + ': ' + self.eType.name;
- return code;
-}
-
-helper VarParameter::print(tabs : Integer) : String {
- var code : String := self.name + ' : ' + self.eType.name;
- return code;
-}
-
-helper EntryOperation::print(tabs : Integer) : String {
- var code : String = printTabs(tabs) + 'main() {\n';
- if not self.body.oclIsUndefined() then {
- code := code + self.body.print(tabs + 1) + printTabs(tabs)
- } endif;
- code := code + '}\n';
- return code;
-}
-
-helper Helper::print(tabs : Integer) : String {
- var code : String = printTabs(tabs) + 'helper ';
- if (self.context != null) then {
- code := code + self.context.eType.name + '::';
- }
- endif;
- code := code + self.name;
- code := code + '(' + printArgs(self.eParameters) + ')';
- code := code + ' : ' + printArgs(self._result) + ' {\n';
- code := code + self.body.print(tabs + 1);
- code := code + printTabs(tabs) + '}\n';
- return code;
-}
-
-helper MappingParameter::print(tabs : Integer) : String {
- var code : String := self.name + ' : ' + self.eType.name;
- return code;
-}
-
-helper MappingOperation::print(tabs : Integer) : String {
- var code : String = printTabs(tabs) + 'mapping ' +
- if self.context.kind = DirectionKind::_inout then 'inout ' else '' endif +
- self.context.eType.name + '::' + self.name;
-
- code := code + '(' + printArgs(self.eParameters) + ')';
- if self._result->notEmpty() then
- code := code + ' : ' + printArgs(self._result)
- endif;
- if self._when->notEmpty() then {
- code := code + '\n' + printTabs(tabs) + 'when { ' + self._when->first().print(0);
- var rest := self._when->asSequence()->subSequence(2, self._when->size());
- rest->forEach(expr) {
- code := code + '; ' + expr.print(0);
- };
- code := code + ' }';
- }
- endif;
- code := code + '\n' + printTabs(tabs) + '{\n';
- code := code + self.body.print(tabs + 1);
- code := code + printTabs(tabs) + '}\n';
- return code;
-}
-
-helper OperationBody::print(tabs : Integer) : String {
- var code : String := printExpressions(self.content, tabs);
- return code;
-}
-
-helper MappingBody::print(tabs : Integer) : String {
- var code : String;
- var needsPopulation := self.initSection->notEmpty();
- if self.initSection->notEmpty() then {
- code := printTabs(tabs) + 'init {\n';
- code := code + printExpressions(self.initSection, tabs + 1);
- code := code + printTabs(tabs) + '}\n';
- }
- endif;
- if needsPopulation then {
- code := code + printTabs(tabs) + 'population {\n';
- code := code + printExpressions(self.content, tabs + 1);
- code := code + printTabs(tabs) + '}\n';
- }
- else {
- code := code + printExpressions(self.content, tabs);
- }
- endif;
- if self.endSection->notEmpty() then {
- code := code + printTabs(tabs) + 'end {\n';
- code := code + printExpressions(self.endSection,tabs + 1);
- code := code + printTabs(tabs) + '}\n';
- }
- endif;
-
- return code;
-}
-
-helper MappingCallExp::print(tabs : Integer) : String {
- var code : String := self.source.print(0) + '.' + 'map ';
- code := code + self.referredOperation.print(0) + '(' + printArgs(self.argument) + ')';
- return code;
-}
-
-helper ImperativeIterateExp::print(tabs : Integer) : String {
- var code : String := self.source.print(0) + '->' +
- self.name +
- '(';
- var iter := self.iterator->first().repr();
- code := code + iter;
- /*
- var iter := self.iterator->first().oclAsType(ocl::ecore::Variable);
- code := code + iter.name + ' : ' + iter.eType.name;
- self.iterator->subOrderedSet(2,self.iterator->size())->forEach(it) {
- iter := it.oclAsType(ocl::ecore::Variable);
- code := code + ', ' + iter.name + iter.eType.name;
- };
- */
- if (self.body != null) then
- code := code + '|' + self.body.print(0)
- endif;
- if (self.condition != null) then
- code := code + '|' + self.condition.print(0)
- endif;
- code := code + ')';
- return code;
-}
-
-helper ImperativeLoopExp::print(tabs : Integer) : String {
- var code : String := self.source.print(0) + '->' +
- self.name +
- '(';
- var iter := self.iterator->first().repr();
- code := code + iter;
- /*
- var iter := self.iterator->first().oclAsType(ocl::ecore::Variable);
- code := code + iter.name + ' : ' + iter.eType.name;
- self.iterator->subOrderedSet(2,self.iterator->size())->forEach(it) {
- iter := it.oclAsType(ocl::ecore::Variable);
- code := code + ', ' + iter.name + iter.eType.name;
- };
- */
- if (self.condition != null) then {
- code := code + '|' + self.condition.print(0)
- }
- endif;
-
- code := code + ')';
-
- if (self.body != null) then {
- code := code + self.body.print(tabs);
- }
- endif;
-
- return code;
-}
-
-helper ObjectExp::print(tabs : Integer) : String {
- var code : String := 'object ' + self.referredObject.name;
- code := code + ' : ' + self.eType.name + ' {\n';
- code := code + self.body.print(tabs + 1);
- code := code + printTabs(tabs) + '}';
- return code;
-}
-
-helper SwitchExp::print(tabs : Integer) : String {
- var code : String := 'switch {\n';
- code := code + printExpressions(self.alternativePart, tabs + 1);
- if (self.elsePart != null) then {
- code := code + '\n' + printTabs(tabs + 1) + 'else ' + self.elsePart.print(tabs + 1);
- }
- endif;
- code := code + '\n' + printTabs(tabs) + '}';
- return code;
-}
-
-helper AltExp::print(tabs : Integer) : String {
- var code : String := 'case ' + ' (' + self.condition.print(0) + ')\n';
- code := code + printTabs(tabs) + self.body.print(tabs);
- return code;
-}
-
-helper AssertExp::print(tabs : Integer) : String {
- var code : String := 'assert(' + self.assertion.print(0) + ')';
- return code;
-}
-
-helper AssignExp::print(tabs : Integer) : String {
- var code : String := self.left.print(0);
- code := code + ' := ';
- self.value->forEach(expr) {
- code := code + expr.print(0);
- };
- return code;
-}
-
-helper BlockExp::print(tabs : Integer) : String {
- var code : String := '{\n';
- code := code + printExpressions(self.body,tabs + 1);
- code := code + printTabs(tabs) + '}';
- return code
-}
-
-helper BreakExp::print(tabs : Integer) : String {
- var code : String := 'break';
- return code;
-}
-
-helper CatchExp::print(tabs : Integer) : String {
- var code : String := 'catch';
- return code;
-}
-
-helper ComputeExp::print(tabs : Integer) : String {
- var code : String := 'compute(' + self.returnedElement.repr() + ') ';
- code := code + self.body.print(tabs);
- return code;
-}
-
-helper ContinueExp::print(tabs : Integer) : String {
- var code : String := 'continue';
- return code;
-}
-
-/*
-helper ForExp::print(tabs : Integer) : String {
- var code : String := self.source
- return code;
-}
-*/
-
-helper InstantiationExp::print(tabs : Integer) : String {
- var code : String := 'InstantiationExpNotImpl';
- return code;
-}
-
-helper DictLiteralPart::print(tabs : Integer) : String {
- var code : String := self.key.print(tabs) + ' = ' + self.value.print(tabs);
- return code;
-}
-
-helper DictLiteralExp::print(tabs : Integer) : String {
- var code : String := 'Dict { ';
- code := code + printArgs(self.part->asOrderedSet());
- code := code + ' }';
- return code;
-}
-
-helper ListLiteralExp::print(tabs : Integer) : String {
- var code : String := 'ListLiteralExpNotImpl';
- return code;
-}
-
-helper LogExp::print(tabs : Integer) : String {
- var code : String := 'log(' + printArgs(self.argument) + ')';
- return code;
-}
-
-helper RaiseExp::print(tabs : Integer) : String {
- var code : String := 'raise';
- return code;
-}
-
-helper ReturnExp::print(tabs : Integer) : String {
- var code : String := 'return ' + self.value.print(tabs);
- return code;
-}
-
-helper TryExp::print(tabs : Integer) : String {
- var code : String := 'try';
- return code;
-}
-
-helper Typedef::print(tabs : Integer) : String {
- var code : String := 'typedef';
- return code;
-}
-
-helper UnlinkExp::print(tabs : Integer) : String {
- var code : String := 'unlink';
- return code;
-}
-
-helper UnpackExp::print(tabs : Integer) : String {
- var code : String := 'unpack';
- return code;
-}
-
-helper VariableInitExp::print(tabs : Integer) : String {
- var code := 'var ' + self.referredVariable.name + ' : ' + self.referredVariable.eType.name;
- if (self.referredVariable.initExpression != null) then {
- var iexp := self.referredVariable.initExpression;
- code := code + ' := ' + iexp.print(tabs);
- }
- endif;
- return code;
-}
-
-helper WhileExp::print(tabs : Integer) : String {
- var code : String := 'while (' + self.condition.print(0) + ') ';
- code := code + self.body.print(tabs);
- return code;
-}
-
-helper ocl::ecore::StringLiteralExp::print(tabs : Integer) : String {
- var code : String := self.stringSymbol.replace('\n','\\n').replace('\t','\\t').quotify('\'');
- return code;
-}
-
-helper ocl::ecore::OperationCallExp::print(tabs : Integer) : String {
- var code : String = '';
- if self.oclIsUndefined() or self.oclIsInvalid() or (self.referredOperation.oclIsUndefined() and self.name.oclIsUndefined()) then
- return code
- endif;
-
- if not self.source.oclIsUndefined() then {
- code := code + self.source.print(0);
- if (self.source.oclAsType(EOperation).upperBound <> 1) then {
- code := code + '->';
- } else {
- code := code + '.';
- } endif;
- } endif;
-
- code := code +
- if self.referredOperation.oclIsUndefined() then
- self.name
- else self.referredOperation.oclAsType(ecore::EOperation).name endif;
- code := code + '(' + printArgs(self.argument) + ')';
-
- return code;
-}
-
-helper ocl::ecore::PropertyCallExp::print(tabs : Integer) : String {
- var code : String := self.source.print(0);
- code := code + '.' + if self.name.oclIsUndefined() then self.referredProperty.print(0) else self.name endif;
-
- return code;
-}
-
-helper ocl::ecore::IfExp::print(tabs : Integer) : String {
- var code : String := 'if ' + '(' + self.condition.print(0) + ')' + ' then ';
- code := code + self.thenExpression.print(tabs) + '\n';
- if self.elseExpression != null then {
- code := code + printTabs(tabs) + 'else ' + self.elseExpression.print(tabs) + '\n';
- }
- endif;
- code := code + printTabs(tabs) + 'endif';
- return code;
-}
-
-helper ocl::ecore::OCLExpression::print(tabs : Integer) : String {
- var code : String := self.repr();
- return code;
-}
-
-helper ocl::expressions::OCLExpression::print(tabs : Integer) : String {
- var code : String := self.repr();
- return code;
-}
diff --git a/plugins/org.eclipse.gmf.bridge/transforms/util/GmfGenUtil.qvto b/plugins/org.eclipse.gmf.bridge/transforms/util/GmfGenUtil.qvto
deleted file mode 100644
index 3e30424..0000000
--- a/plugins/org.eclipse.gmf.bridge/transforms/util/GmfGenUtil.qvto
+++ /dev/null
@@ -1,29 +0,0 @@
-/**
-* Copyright (c) 2011, 2012 Montages A.G.
-* All rights reserved. This program and the accompanying materials
-* are made available under the terms of the Eclipse Public License v1.0
-* which accompanies this distribution, and is available at
-* http://www.eclipse.org/legal/epl-v10.html
-*
-* Contributors:
-* Guillaume Hillairet (Montages A.G.) : initial implementation
-*/
-modeltype GMFGEN uses gmfgen('http://www.eclipse.org/gmf/2009/GenModel');
-modeltype ECORE uses ecore('http://www.eclipse.org/emf/2002/Ecore');
-
-library GmfGenUtil;
-
-query GenCommonBase::parentID(visualID: Integer): Boolean = self.oclAsType(EObject).parentID(visualID);
-query Viewmap::parentID(visualID: Integer): Boolean = self.oclAsType(EObject).parentID(visualID);
-query ModelFacet::parentID(visualID: Integer): Boolean = self.oclAsType(EObject).parentID(visualID);
-query GenLinkConstraints::parentID(visualID: Integer): Boolean = self.oclAsType(EObject).parentID(visualID);
-query GenPreferencePage::parentID(visualID: Integer): Boolean = self.oclAsType(EObject).parentID(visualID);
-
-query EObject::parentID(visualID: Integer): Boolean =
- if self.eContainer().oclIsKindOf(GenCommonBase) then
- self.eContainer().oclAsType(GenContainerBase).visualID = visualID
- else false endif;
-
-query GenPreferencePage::parentID(id: String): Boolean = self.oclAsType(GenPreferencePage).iD = id;
-
-query node(list: Set(GenNode), visualID: Integer): GenNode = list->any(e | e.visualID = visualID);
diff --git a/plugins/org.eclipse.gmf.bridge/transforms/util/TraceUtil.qvto b/plugins/org.eclipse.gmf.bridge/transforms/util/TraceUtil.qvto
deleted file mode 100644
index eeedb4f..0000000
--- a/plugins/org.eclipse.gmf.bridge/transforms/util/TraceUtil.qvto
+++ /dev/null
@@ -1,75 +0,0 @@
-/**
-* Copyright (c) 2011, 2012 Montages A.G.
-* All rights reserved. This program and the accompanying materials
-* are made available under the terms of the Eclipse Public License v1.0
-* which accompanies this distribution, and is available at
-* http://www.eclipse.org/legal/epl-v10.html
-*
-* Contributors:
-* Guillaume Hillairet (Montages A.G.) : initial implementation
-*/
-modeltype TRACE uses trace('http:///www.eclipse.org/m2m/qvt/operational/trace.ecore');
-modeltype GMFMAP uses mappings('http://www.eclipse.org/gmf/2006/mappings');
-modeltype GMFGEN uses gmfgen('http://www.eclipse.org/gmf/2009/GenModel');
-modeltype OCL uses ocl('http://www.eclipse.org/ocl/1.1.0/OCL');
-modeltype ECORE uses ecore('http://www.eclipse.org/emf/2002/Ecore');
-
-library TraceUtil;
-
-query traces(): Sequence(TRACE::TraceRecord) {
- return TRACE::TraceRecord.allInstances()->asSequence();
-}
-query Sequence(TRACE::TraceRecord)::inputElementIs(modelElement: GMFMAP::NeedsContainment): Sequence(TRACE::TraceRecord) {
- return self->select(e | e.context.context.value.modelElement = modelElement)->asSequence();
-}
-query Sequence(TRACE::TraceRecord)::inputElementIs(modelElement: GMFMAP::MappingEntry): Sequence(TRACE::TraceRecord) {
- return self->select(e | e.context.context.value.modelElement = modelElement)->asSequence();
-}
-query Sequence(TRACE::TraceRecord)::outputElementIs(modelElement: GMFGEN::GenCommonBase): Sequence(TRACE::TraceRecord) {
- return self->select(e | e._result._result->exists(a | a.value.modelElement = modelElement))->asSequence();
-}
-query TraceRecord::getResultModelElement(): OclAny {
- return self._result._result->first().value.modelElement;
-}
-query TraceRecord::getContextModelElement(): OclAny {
- return self.context.context.value.modelElement;
-}
-query GMFGEN::GenNode::input(): GMFMAP::NodeReference {
- return switch {
- case (self.oclIsTypeOf(GenTopLevelNode)) self.oclAsType(GenTopLevelNode).input();
- case (self.oclIsTypeOf(GenChildNode)) self.oclAsType(GenChildNode).input();
- else null;
- };
-}
-query GMFGEN::GenTopLevelNode::input(): GMFMAP::NodeReference {
- return traces()->outputElementIs(self)->first().getContextModelElement().oclAsType(GMFMAP::TopNodeReference);
-}
-query GMFGEN::GenChildNode::input(): GMFMAP::NodeReference {
- var records := traces()->outputElementIs(self);
- if records->size() = 1 then {
- return records->first().getContextModelElement().oclAsType(GMFMAP::ChildReference)
- } endif;
- return null;
-}
-query GMFGEN::GenLink::input(): GMFMAP::LinkMapping {
- return traces()->outputElementIs(self)->first().getContextModelElement().oclAsType(GMFMAP::LinkMapping);
-}
-query GMFMAP::NeedsContainment::output(): GMFGEN::GenNode {
- var records := traces()->inputElementIs(self);
- if records->size() = 1 then {
- return records->first().getResultModelElement().oclAsType(GenNode)
- } endif;
- return null;
-}
-query GMFMAP::MappingEntry::output(): GMFGEN::GenNode {
- var records := traces()->inputElementIs(self);
- if records->size() = 1 then {
- return records->first().getResultModelElement().oclAsType(GenNode)
- } else {
- return self.getContainer().output();
- } endif;
- return null;
-}
-query GMFMAP::MappingEntry::getContainer(): GMFMAP::NeedsContainment {
- return self.oclAsType(EObject).eContainer().oclAsType(GMFMAP::NeedsContainment);
-} \ No newline at end of file