Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/analyzer/QVTiAS2CGVisitor.java')
-rw-r--r--plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/analyzer/QVTiAS2CGVisitor.java161
1 files changed, 76 insertions, 85 deletions
diff --git a/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/analyzer/QVTiAS2CGVisitor.java b/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/analyzer/QVTiAS2CGVisitor.java
index fca2e1dd9..17d9b49d9 100644
--- a/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/analyzer/QVTiAS2CGVisitor.java
+++ b/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/analyzer/QVTiAS2CGVisitor.java
@@ -105,6 +105,7 @@ import org.eclipse.qvtd.pivot.qvtbase.utilities.QVTbaseUtil;
import org.eclipse.qvtd.pivot.qvtimperative.Area;
import org.eclipse.qvtd.pivot.qvtimperative.Assignment;
import org.eclipse.qvtd.pivot.qvtimperative.BottomPattern;
+import org.eclipse.qvtd.pivot.qvtimperative.BottomStatement;
import org.eclipse.qvtd.pivot.qvtimperative.ConnectionAssignment;
import org.eclipse.qvtd.pivot.qvtimperative.ConnectionStatement;
import org.eclipse.qvtd.pivot.qvtimperative.ConnectionVariable;
@@ -117,10 +118,8 @@ import org.eclipse.qvtd.pivot.qvtimperative.MappingCall;
import org.eclipse.qvtd.pivot.qvtimperative.MappingCallBinding;
import org.eclipse.qvtd.pivot.qvtimperative.MappingLoop;
import org.eclipse.qvtd.pivot.qvtimperative.MappingStatement;
-import org.eclipse.qvtd.pivot.qvtimperative.NavigationAssignment;
-import org.eclipse.qvtd.pivot.qvtimperative.OppositePropertyAssignment;
-import org.eclipse.qvtd.pivot.qvtimperative.PropertyAssignment;
import org.eclipse.qvtd.pivot.qvtimperative.RealizedVariable;
+import org.eclipse.qvtd.pivot.qvtimperative.SetStatement;
import org.eclipse.qvtd.pivot.qvtimperative.Statement;
import org.eclipse.qvtd.pivot.qvtimperative.VariableAssignment;
import org.eclipse.qvtd.pivot.qvtimperative.VariablePredicate;
@@ -392,10 +391,7 @@ public class QVTiAS2CGVisitor extends AS2CGVisitor implements QVTimperativeVisit
for (@NonNull BottomPattern pBottomPattern : pBottomPatterns) {
List<@NonNull Assignment> assignment = ClassUtil.nullFree(pBottomPattern.getAssignment());
for (@NonNull Assignment pAssignment : assignment) {
- if (pAssignment instanceof PropertyAssignment) {
- cgPropertyAssignments.add(doVisit(CGPropertyAssignment.class, pAssignment));
- }
- else if (pAssignment instanceof ConnectionAssignment) {
+ if (pAssignment instanceof ConnectionAssignment) {
cgConnectionAssignments.add(doVisit(CGConnectionAssignment.class, pAssignment));
}
else {
@@ -709,6 +705,11 @@ public class QVTiAS2CGVisitor extends AS2CGVisitor implements QVTimperativeVisit
}
@Override
+ public @Nullable CGNamedElement visitBottomStatement(@NonNull BottomStatement object) {
+ return visitStatement(object);
+ }
+
+ @Override
public @Nullable CGNamedElement visitConnectionAssignment(@NonNull ConnectionAssignment asConnectionAssignment) {
Variable asVariable = asConnectionAssignment.getTargetVariable();
if (asVariable == null) {
@@ -913,21 +914,77 @@ public class QVTiAS2CGVisitor extends AS2CGVisitor implements QVTimperativeVisit
}
@Override
- public @Nullable CGNamedElement visitNavigationAssignment(@NonNull NavigationAssignment asNavigationAssignment) {
- Transformation asTransformation = ClassUtil.nonNullModel(QVTbaseUtil.getContainingTransformation(asNavigationAssignment));
+ public @Nullable CGNamedElement visitPattern(@NonNull Pattern object) {
+ return visiting(object);
+ }
+
+ @Override
+ public @Nullable CGIfExp visitPredicate(@NonNull Predicate asPredicate) {
+ CGIfExp cgPredicate = CGModelFactory.eINSTANCE.createCGIfExp();
+ cgPredicate.setTypeId(analyzer.getTypeId(TypeId.BOOLEAN));
+ cgPredicate.setRequired(true);
+ OCLExpression asConditionExpression = asPredicate.getConditionExpression();
+ assert asConditionExpression != null;
+ cgPredicate.setCondition(doVisit(CGValuedElement.class, asConditionExpression));
+ CGConstantExp cgElse = analyzer.createCGConstantExp(asConditionExpression, analyzer.getBoolean(false));
+ setAst(cgElse, asConditionExpression);
+ cgElse.setTypeId(analyzer.getTypeId(TypeId.BOOLEAN));
+ cgElse.setRequired(true);
+ cgPredicate.setElseExpression(cgElse);
+ return cgPredicate;
+ }
+
+ /* @Override
+ public @Nullable CGNamedElement visitMiddlePropertyAssignment(@NonNull MiddlePropertyAssignment asPropertyAssignment) {
+// Property asProperty = ClassUtil.nonNullModel(asPropertyAssignment.getTargetProperty());
+ CGMiddlePropertyAssignment cgPropertyAssignment = QVTiCGModelFactory.eINSTANCE.createCGMiddlePropertyAssignment();
+// setPivot(cgPropertyAssignment, asPredicate);
+ cgPropertyAssignment.setSlotValue(doVisit(CGValuedElement.class, asPropertyAssignment.getSlotExpression()));
+ Property asProperty = asPropertyAssignment.getTargetProperty();
+ cgPropertyAssignment.setReferredProperty(asProperty);
+// cgPredicate.setName(asPredicate.getName());
+ cgPropertyAssignment.setTypeId(analyzer.getTypeId(TypeId.OCL_VOID));
+// cgMappingCallBinding.setValueName(localnameasMappingCallBinding.getBoundVariable().getName());
+ cgPropertyAssignment.setInitValue(doVisit(CGValuedElement.class, asPropertyAssignment.getValue()));
+ EStructuralFeature eStructuralFeature = (EStructuralFeature) asProperty.getESObject();
+ if (eStructuralFeature != null) {
+ try {
+ genModelHelper.getGetAccessor(eStructuralFeature);
+ cgPropertyAssignment.setEStructuralFeature(eStructuralFeature);
+ } catch (GenModelException e) {
+ }
+ }
+ return cgPropertyAssignment;
+ } */
+
+ @Override
+ public @Nullable CGNamedElement visitRealizedVariable(@NonNull RealizedVariable object) {
+ // CGExecutorType cgExecutorType = analyzer.createExecutorType(pTypeExp.getReferredType());
+ // cgTypeExp.setExecutorType(cgExecutorType);
+ return visiting(object);
+ }
+
+ @Override
+ public @Nullable CGNamedElement visitRule(@NonNull Rule object) {
+ return visiting(object);
+ }
+
+ @Override
+ public @Nullable CGNamedElement visitSetStatement(@NonNull SetStatement asSetStatement) {
+ Transformation asTransformation = ClassUtil.nonNullModel(QVTbaseUtil.getContainingTransformation(asSetStatement));
QVTiTransformationAnalysis transformationAnalysis = analyzer.getCodeGenerator().getTransformationAnalysis(asTransformation);
- Integer cacheIndex = transformationAnalysis.getCacheIndex(asNavigationAssignment);
+ Integer cacheIndex = transformationAnalysis.getCacheIndex(asSetStatement);
if (cacheIndex != null) {
// Property asProperty = ClassUtil.nonNullModel(asPropertyAssignment.getTargetProperty());
CGMiddlePropertyAssignment cgPropertyAssignment = QVTiCGModelFactory.eINSTANCE.createCGMiddlePropertyAssignment();
- setAst(cgPropertyAssignment, asNavigationAssignment);
- cgPropertyAssignment.setSlotValue(doVisit(CGValuedElement.class, asNavigationAssignment.getSlotExpression()));
- Property asProperty = QVTimperativeUtil.getTargetProperty(asNavigationAssignment);
+ setAst(cgPropertyAssignment, asSetStatement);
+ cgPropertyAssignment.setSlotValue(doVisit(CGValuedElement.class, asSetStatement.getSlotExpression()));
+ Property asProperty = QVTimperativeUtil.getTargetProperty(asSetStatement);
cgPropertyAssignment.setReferredProperty(asProperty);
// cgPredicate.setName(asPredicate.getName());
cgPropertyAssignment.setTypeId(analyzer.getTypeId(TypeId.OCL_VOID));
// cgMappingCallBinding.setValueName(localnameasMappingCallBinding.getBoundVariable().getName());
- cgPropertyAssignment.setInitValue(doVisit(CGValuedElement.class, asNavigationAssignment.getValue()));
+ cgPropertyAssignment.setInitValue(doVisit(CGValuedElement.class, asSetStatement.getValue()));
EStructuralFeature eStructuralFeature = (EStructuralFeature) asProperty.getESObject();
if (eStructuralFeature != null) {
try {
@@ -940,8 +997,8 @@ public class QVTiAS2CGVisitor extends AS2CGVisitor implements QVTimperativeVisit
return cgPropertyAssignment;
}
else {
- Property asTargetProperty = QVTimperativeUtil.getTargetProperty(asNavigationAssignment);
- LibraryProperty libraryProperty = metamodelManager.getImplementation(asNavigationAssignment, null, asTargetProperty);
+ Property asTargetProperty = QVTimperativeUtil.getTargetProperty(asSetStatement);
+ LibraryProperty libraryProperty = metamodelManager.getImplementation(asSetStatement, null, asTargetProperty);
CGPropertyAssignment cgPropertyAssignment = null;
if (isEcoreProperty(libraryProperty)) {
EStructuralFeature eStructuralFeature = (EStructuralFeature) asTargetProperty.getESObject();
@@ -974,13 +1031,13 @@ public class QVTiAS2CGVisitor extends AS2CGVisitor implements QVTimperativeVisit
if (cgPropertyAssignment == null) {
cgPropertyAssignment = QVTiCGModelFactory.eINSTANCE.createCGPropertyAssignment();
}
- setAst(cgPropertyAssignment, asNavigationAssignment);
- cgPropertyAssignment.setSlotValue(doVisit(CGValuedElement.class, asNavigationAssignment.getSlotExpression()));
+ setAst(cgPropertyAssignment, asSetStatement);
+ cgPropertyAssignment.setSlotValue(doVisit(CGValuedElement.class, asSetStatement.getSlotExpression()));
cgPropertyAssignment.setReferredProperty(asTargetProperty);
// cgPredicate.setName(asPredicate.getName());
cgPropertyAssignment.setTypeId(analyzer.getTypeId(TypeId.OCL_VOID));
// cgMappingCallBinding.setValueName(localnameasMappingCallBinding.getBoundVariable().getName());
- cgPropertyAssignment.setInitValue(doVisit(CGValuedElement.class, asNavigationAssignment.getValue()));
+ cgPropertyAssignment.setInitValue(doVisit(CGValuedElement.class, asSetStatement.getValue()));
CGExecutorProperty cgExecutorProperty = analyzer.createExecutorProperty(asTargetProperty);
cgPropertyAssignment.setExecutorProperty(cgExecutorProperty);
@@ -989,72 +1046,6 @@ public class QVTiAS2CGVisitor extends AS2CGVisitor implements QVTimperativeVisit
}
@Override
- public @Nullable CGNamedElement visitPattern(@NonNull Pattern object) {
- return visiting(object);
- }
-
- @Override
- public @Nullable CGIfExp visitPredicate(@NonNull Predicate asPredicate) {
- CGIfExp cgPredicate = CGModelFactory.eINSTANCE.createCGIfExp();
- cgPredicate.setTypeId(analyzer.getTypeId(TypeId.BOOLEAN));
- cgPredicate.setRequired(true);
- OCLExpression asConditionExpression = asPredicate.getConditionExpression();
- assert asConditionExpression != null;
- cgPredicate.setCondition(doVisit(CGValuedElement.class, asConditionExpression));
- CGConstantExp cgElse = analyzer.createCGConstantExp(asConditionExpression, analyzer.getBoolean(false));
- setAst(cgElse, asConditionExpression);
- cgElse.setTypeId(analyzer.getTypeId(TypeId.BOOLEAN));
- cgElse.setRequired(true);
- cgPredicate.setElseExpression(cgElse);
- return cgPredicate;
- }
-
- /* @Override
- public @Nullable CGNamedElement visitMiddlePropertyAssignment(@NonNull MiddlePropertyAssignment asPropertyAssignment) {
-// Property asProperty = ClassUtil.nonNullModel(asPropertyAssignment.getTargetProperty());
- CGMiddlePropertyAssignment cgPropertyAssignment = QVTiCGModelFactory.eINSTANCE.createCGMiddlePropertyAssignment();
-// setPivot(cgPropertyAssignment, asPredicate);
- cgPropertyAssignment.setSlotValue(doVisit(CGValuedElement.class, asPropertyAssignment.getSlotExpression()));
- Property asProperty = asPropertyAssignment.getTargetProperty();
- cgPropertyAssignment.setReferredProperty(asProperty);
-// cgPredicate.setName(asPredicate.getName());
- cgPropertyAssignment.setTypeId(analyzer.getTypeId(TypeId.OCL_VOID));
-// cgMappingCallBinding.setValueName(localnameasMappingCallBinding.getBoundVariable().getName());
- cgPropertyAssignment.setInitValue(doVisit(CGValuedElement.class, asPropertyAssignment.getValue()));
- EStructuralFeature eStructuralFeature = (EStructuralFeature) asProperty.getESObject();
- if (eStructuralFeature != null) {
- try {
- genModelHelper.getGetAccessor(eStructuralFeature);
- cgPropertyAssignment.setEStructuralFeature(eStructuralFeature);
- } catch (GenModelException e) {
- }
- }
- return cgPropertyAssignment;
- } */
-
- @Override
- public @Nullable CGNamedElement visitOppositePropertyAssignment(@NonNull OppositePropertyAssignment asPropertyAssignment) {
- return visitNavigationAssignment(asPropertyAssignment);
- }
-
- @Override
- public @Nullable CGNamedElement visitPropertyAssignment(@NonNull PropertyAssignment asPropertyAssignment) {
- return visitNavigationAssignment(asPropertyAssignment);
- }
-
- @Override
- public @Nullable CGNamedElement visitRealizedVariable(@NonNull RealizedVariable object) {
- // CGExecutorType cgExecutorType = analyzer.createExecutorType(pTypeExp.getReferredType());
- // cgTypeExp.setExecutorType(cgExecutorType);
- return visiting(object);
- }
-
- @Override
- public @Nullable CGNamedElement visitRule(@NonNull Rule object) {
- return visiting(object);
- }
-
- @Override
public @Nullable CGNamedElement visitStatement(@NonNull Statement object) {
return visiting(object);
}

Back to the top