Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEd Willink2016-09-15 13:34:45 +0000
committerEd Willink2016-09-19 11:19:41 +0000
commit32dac84eb6b99956510203243eba930d52fe5afe (patch)
tree1003c33b26a77d9f50f88e74f5c2c9590142d996
parentb54d7af147d38d5b72dd5861598f3aea6eb0a9d9 (diff)
downloadorg.eclipse.qvtd-32dac84eb6b99956510203243eba930d52fe5afe.tar.gz
org.eclipse.qvtd-32dac84eb6b99956510203243eba930d52fe5afe.tar.xz
org.eclipse.qvtd-32dac84eb6b99956510203243eba930d52fe5afe.zip
[500369] Eliminate QVTimperativeEnvironmentUtil
-rw-r--r--plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/attributes/MappingAttribution.java7
-rw-r--r--plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/attributes/MappingCallBindingAttribution.java14
-rw-r--r--plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/attributes/QVTimperativeEnvironmentUtil.java69
3 files changed, 4 insertions, 86 deletions
diff --git a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/attributes/MappingAttribution.java b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/attributes/MappingAttribution.java
index 6a7e3920c..4b79800f3 100644
--- a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/attributes/MappingAttribution.java
+++ b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/attributes/MappingAttribution.java
@@ -76,10 +76,8 @@ public class MappingAttribution extends AbstractAttribution
environmentView.addNamedElement(asStatement);
}
}
- QVTimperativeEnvironmentUtil.addMiddleGuardVariables(environmentView, mapping);
- QVTimperativeEnvironmentUtil.addSideGuardVariables(environmentView, mapping, null);
- QVTimperativeEnvironmentUtil.addMiddleBottomVariables(environmentView, mapping);
- QVTimperativeEnvironmentUtil.addSideBottomVariables(environmentView, mapping, null);
+ environmentView.addNamedElements(mapping.getOwnedGuardVariables());
+ environmentView.addNamedElements(mapping.getInoutVariables());
Transformation transformation = QVTimperativeUtil.getContainingTransformation(mapping);
if (transformation != null) {
for (TypedModel typedModel : transformation.getModelParameter()) {
@@ -91,7 +89,6 @@ public class MappingAttribution extends AbstractAttribution
}
}
}
-
}
return scopeView.getParent();
}
diff --git a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/attributes/MappingCallBindingAttribution.java b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/attributes/MappingCallBindingAttribution.java
index 1fc4da938..9ca54bd94 100644
--- a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/attributes/MappingCallBindingAttribution.java
+++ b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/attributes/MappingCallBindingAttribution.java
@@ -34,18 +34,8 @@ public class MappingCallBindingAttribution extends EmptyAttribution
if (targetReference.getEType() == PivotPackage.Literals.VARIABLE_DECLARATION) {
Mapping referredMapping = mappingCall.getReferredMapping();
if (referredMapping != null) {
- QVTimperativeEnvironmentUtil.addMiddleGuardVariables(environmentView, referredMapping);
- QVTimperativeEnvironmentUtil.addSideGuardVariables(environmentView, referredMapping, null);
- }
- }
- else { // FIXME Distinguish referred.context mapping
- EObject eContainer = mappingCall.eContainer();
- if (eContainer instanceof Mapping) {
- Mapping mapping = (Mapping)eContainer;
- QVTimperativeEnvironmentUtil.addMiddleGuardVariables(environmentView, mapping);
- QVTimperativeEnvironmentUtil.addSideGuardVariables(environmentView, mapping, null);
- QVTimperativeEnvironmentUtil.addMiddleBottomVariables(environmentView, mapping);
- QVTimperativeEnvironmentUtil.addSideBottomVariables(environmentView, mapping, null);
+ environmentView.addNamedElements(referredMapping.getOwnedGuardVariables());
+ environmentView.addNamedElements(referredMapping.getInoutVariables());
}
}
}
diff --git a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/attributes/QVTimperativeEnvironmentUtil.java b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/attributes/QVTimperativeEnvironmentUtil.java
deleted file mode 100644
index 15b99b533..000000000
--- a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/attributes/QVTimperativeEnvironmentUtil.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012, 2014 Willink Transformations and others.
- * 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:
- * E.D.Willink - initial API and implementation
- *******************************************************************************/
-package org.eclipse.qvtd.pivot.qvtimperative.attributes;
-
-import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.jdt.annotation.Nullable;
-import org.eclipse.ocl.pivot.internal.scoping.EnvironmentView;
-import org.eclipse.qvtd.pivot.qvtbase.TypedModel;
-import org.eclipse.qvtd.pivot.qvtimperative.Mapping;
-import org.eclipse.qvtd.pivot.qvtimperative.Statement;
-import org.eclipse.qvtd.pivot.qvtimperative.VariableStatement;
-
-public class QVTimperativeEnvironmentUtil
-{
- public static void addMiddleBottomVariables(@NonNull EnvironmentView environmentView, @Nullable Mapping mapping) {
- if (mapping != null) {
- addMiddleVariables(environmentView, mapping, true);
- }
- }
-
- public static void addMiddleGuardVariables(@NonNull EnvironmentView environmentView, @Nullable Mapping mapping) {
- if (mapping != null) {
- addMiddleVariables(environmentView, mapping, false);
- }
- }
-
- private static void addMiddleVariables(@NonNull EnvironmentView environmentView, @NonNull Mapping mapping, boolean bottomToo) {
- if (bottomToo) {
- for (Statement asStatement : mapping.getOwnedStatements()) {
- if (asStatement instanceof VariableStatement) {
- environmentView.addNamedElement(asStatement);
- }
- }
- }
- environmentView.addNamedElements(mapping.getOwnedGuardVariables());
- environmentView.addNamedElements(mapping.getInoutVariables());
- }
-
- public static void addSideBottomVariables(@NonNull EnvironmentView environmentView, @Nullable Mapping mapping, @Nullable TypedModel typedModel) {
- if (mapping != null) {
- addSideVariables(environmentView, mapping, typedModel, true);
- }
- }
-
- public static void addSideGuardVariables(@NonNull EnvironmentView environmentView, @Nullable Mapping mapping, @Nullable TypedModel typedModel) {
- if (mapping != null) {
- addSideVariables(environmentView, mapping, typedModel, false);
- }
- }
-
- private static void addSideVariables(@NonNull EnvironmentView environmentView, @NonNull Mapping mapping, @Nullable TypedModel typedModel, boolean bottomToo) {
- if (bottomToo) {
- for (Statement asStatement : mapping.getOwnedStatements()) {
- if (asStatement instanceof VariableStatement) {
- environmentView.addNamedElement(asStatement);
- }
- }
- }
- environmentView.addNamedElements(mapping.getInoutVariables());
- }
-}

Back to the top