Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEd Willink2016-05-07 03:48:31 -0400
committerEd Willink2016-05-07 07:02:30 -0400
commit8e9aa56a3073a1a29d62aeeec384ac8c9bbc5f45 (patch)
tree13124ffdc286dd416740619dbf6550ebf6154007
parentc62acd46753b80087b26ff5d56f292bfff9a98df (diff)
downloadorg.eclipse.qvtd-8e9aa56a3073a1a29d62aeeec384ac8c9bbc5f45.tar.gz
org.eclipse.qvtd-8e9aa56a3073a1a29d62aeeec384ac8c9bbc5f45.tar.xz
org.eclipse.qvtd-8e9aa56a3073a1a29d62aeeec384ac8c9bbc5f45.zip
[486722] Correct usage for middle domain variables
-rw-r--r--plugins/org.eclipse.qvtd.pivot.qvtcorebase/src/org/eclipse/qvtd/pivot/qvtcorebase/analysis/AbstractDomainUsageAnalysis.java16
-rw-r--r--plugins/org.eclipse.qvtd.pivot.qvtcorebase/src/org/eclipse/qvtd/pivot/qvtcorebase/analysis/DomainUsage.java5
-rw-r--r--plugins/org.eclipse.qvtd.pivot.qvtcorebase/src/org/eclipse/qvtd/pivot/qvtcorebase/analysis/RootDomainUsageAnalysis.java16
3 files changed, 30 insertions, 7 deletions
diff --git a/plugins/org.eclipse.qvtd.pivot.qvtcorebase/src/org/eclipse/qvtd/pivot/qvtcorebase/analysis/AbstractDomainUsageAnalysis.java b/plugins/org.eclipse.qvtd.pivot.qvtcorebase/src/org/eclipse/qvtd/pivot/qvtcorebase/analysis/AbstractDomainUsageAnalysis.java
index d464c88aa..236cf02cc 100644
--- a/plugins/org.eclipse.qvtd.pivot.qvtcorebase/src/org/eclipse/qvtd/pivot/qvtcorebase/analysis/AbstractDomainUsageAnalysis.java
+++ b/plugins/org.eclipse.qvtd.pivot.qvtcorebase/src/org/eclipse/qvtd/pivot/qvtcorebase/analysis/AbstractDomainUsageAnalysis.java
@@ -170,7 +170,7 @@ public abstract class AbstractDomainUsageAnalysis extends AbstractExtendingQVTco
DomainUsage usage = element2usage.get(element);
if (usage == null) {
usage = element.accept(this);
- if (usage == null) { // FIXME debugging
+ if ((usage == null) || usage.isNone()) { // FIXME debugging
usage = element.accept(this);
}
assert usage != null : "null usage for " + element.eClass().getName() + " " + element;
@@ -266,7 +266,8 @@ public abstract class AbstractDomainUsageAnalysis extends AbstractExtendingQVTco
for (Variable variable : ((AbstractMapping)rule).getGuardPattern().getVariable()) {
if (variable != null) {
DomainUsage variableUsage = visit(variable.getType());
- if (variableUsage != primitiveUsage) {
+// if (variableUsage != primitiveUsage) {
+ if (!variableUsage.isInput() && !variableUsage.isOutput() && !variableUsage.isPrimitive()) {
variableUsage = middleUsage;
}
assert variableUsage != null;
@@ -277,6 +278,12 @@ public abstract class AbstractDomainUsageAnalysis extends AbstractExtendingQVTco
}
protected void setUsage(@NonNull Element element, @NonNull DomainUsage newUsage) {
+// if (newUsage.isNone()) {
+// element.toString();
+// }
+// if ("s".equals(element.toString())) {
+// element.toString();
+// }
element2usage.put(element, newUsage);
((DomainUsage.Internal)newUsage).addUsedBy(element);
// System.out.println(" setUsage " + getClass().getSimpleName() + "@" + Integer.toHexString(System.identityHashCode(this))
@@ -334,6 +341,9 @@ public abstract class AbstractDomainUsageAnalysis extends AbstractExtendingQVTco
}
DomainUsage usage = element2usage.get(element);
if (usage == null) {
+// if ("s : StmcMM::StateMachine[1]".equals(element.toString())) {
+// element.toString();
+// }
usage = element.accept(this);
if (usage == null) { // FIXME debugging
usage = element.accept(this);
@@ -871,7 +881,7 @@ public abstract class AbstractDomainUsageAnalysis extends AbstractExtendingQVTco
return visit(ownedInit);
}
Area area = QVTcoreBaseUtil.getContainingArea(object);
- if (area != null) {
+ if (area instanceof Domain) {
return visit(area);
}
else {
diff --git a/plugins/org.eclipse.qvtd.pivot.qvtcorebase/src/org/eclipse/qvtd/pivot/qvtcorebase/analysis/DomainUsage.java b/plugins/org.eclipse.qvtd.pivot.qvtcorebase/src/org/eclipse/qvtd/pivot/qvtcorebase/analysis/DomainUsage.java
index ff6f2b4d2..74fa9b5ed 100644
--- a/plugins/org.eclipse.qvtd.pivot.qvtcorebase/src/org/eclipse/qvtd/pivot/qvtcorebase/analysis/DomainUsage.java
+++ b/plugins/org.eclipse.qvtd.pivot.qvtcorebase/src/org/eclipse/qvtd/pivot/qvtcorebase/analysis/DomainUsage.java
@@ -97,6 +97,11 @@ public interface DomainUsage
boolean isMiddle();
/**
+ * Return true if this usage includes usage in no domain.
+ */
+ boolean isNone();
+
+ /**
* Return true if this usage includes usage in an output domain, a domain that is fully enforceable transformation-wide.
*/
boolean isOutput();
diff --git a/plugins/org.eclipse.qvtd.pivot.qvtcorebase/src/org/eclipse/qvtd/pivot/qvtcorebase/analysis/RootDomainUsageAnalysis.java b/plugins/org.eclipse.qvtd.pivot.qvtcorebase/src/org/eclipse/qvtd/pivot/qvtcorebase/analysis/RootDomainUsageAnalysis.java
index 12e56e6e1..fd1770080 100644
--- a/plugins/org.eclipse.qvtd.pivot.qvtcorebase/src/org/eclipse/qvtd/pivot/qvtcorebase/analysis/RootDomainUsageAnalysis.java
+++ b/plugins/org.eclipse.qvtd.pivot.qvtcorebase/src/org/eclipse/qvtd/pivot/qvtcorebase/analysis/RootDomainUsageAnalysis.java
@@ -134,6 +134,11 @@ public class RootDomainUsageAnalysis extends AbstractDomainUsageAnalysis impleme
}
@Override
+ public boolean isNone() {
+ return bitMask == 0;
+ }
+
+ @Override
public boolean isOutput() {
return (bitMask & outputUsage.bitMask) != 0;
}
@@ -334,8 +339,8 @@ public class RootDomainUsageAnalysis extends AbstractDomainUsageAnalysis impleme
* The properties of the input models that are assigned by mappings and which cannot therefore
* be trusted to be loaded from the input models.
*/
- private final @NonNull Set<Property> dirtyProperties = new HashSet<Property>();
- private final @NonNull Set<EReference> dirtyEReferences = new HashSet<EReference>();
+ private final @NonNull Set<@NonNull Property> dirtyProperties = new HashSet<@NonNull Property>();
+ private final @NonNull Set<@NonNull EReference> dirtyEReferences = new HashSet<@NonNull EReference>();
protected RootDomainUsageAnalysis(@NonNull EnvironmentFactory environmentFactory) {
@@ -370,11 +375,14 @@ public class RootDomainUsageAnalysis extends AbstractDomainUsageAnalysis impleme
EObject eObject = tit.next();
if (eObject instanceof PropertyAssignment) {
PropertyAssignment propertyAssignment = (PropertyAssignment)eObject;
+// if ("s.name := sn".equals(eObject.toString())) {
+// eObject.toString();
+// }
OCLExpression slotExpression = propertyAssignment.getSlotExpression();
assert slotExpression != null;
DomainUsage domainUsage = getUsage(slotExpression);
if (!domainUsage.isOutput() && !domainUsage.isMiddle()) {
- Property targetProperty = propertyAssignment.getTargetProperty();
+ Property targetProperty = ClassUtil.nonNullState(propertyAssignment.getTargetProperty());
// System.out.println("Dirty " + targetProperty + " for " + eObject);
dirtyProperties.add(targetProperty);
EObject eProperty = targetProperty.getESObject();
@@ -384,7 +392,7 @@ public class RootDomainUsageAnalysis extends AbstractDomainUsageAnalysis impleme
}
}
}
- for (Property dirtyProperty : dirtyProperties) {
+ for (@NonNull Property dirtyProperty : dirtyProperties) {
if (!dirtyProperty.isIsTransient()) {
System.err.println("Dirty " + dirtyProperty + " is not transient");
}

Back to the top