Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEd Willink2016-10-31 14:41:52 +0000
committerEd Willink2016-10-31 17:39:35 +0000
commit04985be519fa240a2f243b0aca964c4611e68170 (patch)
tree2d836d8425e6e88da0466a776b211c59d2e7c123 /plugins
parentbc738d194634ecd84dae484c00022127cb5c2a67 (diff)
downloadorg.eclipse.qvtd-04985be519fa240a2f243b0aca964c4611e68170.tar.gz
org.eclipse.qvtd-04985be519fa240a2f243b0aca964c4611e68170.tar.xz
org.eclipse.qvtd-04985be519fa240a2f243b0aca964c4611e68170.zip
[506753] Don't lose Collection-sourced edge dependencies
Diffstat (limited to 'plugins')
-rw-r--r--plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtp2qvts/AbstractMappingRegion.java1
-rw-r--r--plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtp2qvts/AbstractRegion.java22
-rw-r--r--plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtp2qvts/BasicMappingRegion.java1
-rw-r--r--plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtp2qvts/ClassDatumAnalysis.java19
-rw-r--r--plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtp2qvts/RegionUtil.java27
-rw-r--r--plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtp2qvts/RootScheduledRegion.java4
-rw-r--r--plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvti/AbstractScheduledRegion2Mapping.java10
7 files changed, 54 insertions, 30 deletions
diff --git a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtp2qvts/AbstractMappingRegion.java b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtp2qvts/AbstractMappingRegion.java
index 8095d21f8..890d15358 100644
--- a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtp2qvts/AbstractMappingRegion.java
+++ b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtp2qvts/AbstractMappingRegion.java
@@ -147,6 +147,7 @@ public abstract class AbstractMappingRegion extends AbstractRegion implements Ma
protected void addHeadNode(@NonNull Node headNode) {
assert basicGetSymbolName() == null;
+ if (headNodes != null) { assert !headNodes.contains(headNode); }
getHeadNodes().add(headNode);
}
diff --git a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtp2qvts/AbstractRegion.java b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtp2qvts/AbstractRegion.java
index a62db6552..b09916377 100644
--- a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtp2qvts/AbstractRegion.java
+++ b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtp2qvts/AbstractRegion.java
@@ -1081,14 +1081,14 @@ public abstract class AbstractRegion implements Region, ToDOT.ToDOTable
if (realizedEdges != null) {
List<@NonNull Node> sourceNodes = new ArrayList<>();
for (@NonNull NavigableEdge realizedEdge : realizedEdges) {
- if (RegionUtil.isConformantSource(realizedEdge, predicatedEdge) && RegionUtil.isConformantTarget(realizedEdge, predicatedEdge)) {
+ if (RegionUtil.isElementallyConformantSource(realizedEdge, predicatedEdge) && RegionUtil.isConformantTarget(realizedEdge, predicatedEdge)) {
sourceNodes.add(realizedEdge.getTarget());
}
}
NodeConnection nodeConnection = invokingRegion2.getAttributeConnection(sourceNodes, predicatedEdge.getSource().getCompleteClass(), predicatedProperty, classDatumAnalysis);
nodeConnection.addUsedTargetNode(castTarget, false);
if (QVTp2QVTs.CONNECTION_CREATION.isActive()) {
- QVTp2QVTs.CONNECTION_CREATION.println(" Attribute NodeConnection to " + castTarget);
+ QVTp2QVTs.CONNECTION_CREATION.println(" Attribute NodeConnection \"" + nodeConnection + "\" to " + castTarget);
// Scheduler.CONNECTIONS.println(" classDatumAnalysis " + classDatumAnalysis);
// for (@NonNull Node sourceNode : sourceNodes) {
// Scheduler.CONNECTIONS.println(" from " + sourceNode.getRegion());
@@ -1122,7 +1122,7 @@ public abstract class AbstractRegion implements Region, ToDOT.ToDOTable
Set<@NonNull Region> conformantEdgeSourceRegions = null;
List<@NonNull NavigableEdge> thoseEdges = null;
for (@NonNull NavigableEdge realizedEdge : realizedEdges) {
- if (RegionUtil.isConformantSource(realizedEdge, predicatedEdge) && RegionUtil.isConformantTarget(realizedEdge, predicatedEdge)) {
+ if (RegionUtil.isElementallyConformantSource(realizedEdge, predicatedEdge) && RegionUtil.isConformantTarget(realizedEdge, predicatedEdge)) {
if (thoseEdges == null) {
thoseEdges = new ArrayList<>();
conformantEdgeSourceRegions = new HashSet<>();
@@ -1136,10 +1136,15 @@ public abstract class AbstractRegion implements Region, ToDOT.ToDOTable
}
if ((thoseEdges != null) && !nodeSourceRegions.containsAll(conformantEdgeSourceRegions)) {
EdgeConnection edgeConnection = invokingRegion2.getEdgeConnection(thoseEdges, predicatedProperty);
+ if (QVTp2QVTs.CONNECTION_CREATION.isActive()) {
+ QVTp2QVTs.CONNECTION_CREATION.println(" EdgeConnection \"" + edgeConnection + "\" to " + predicatedEdge);
+ }
if (!Iterables.contains(edgeConnection.getTargetEdges(), castEdge)) {
edgeConnection.addUsedTargetEdge(castEdge, false);
if (QVTp2QVTs.CONNECTION_CREATION.isActive()) {
- QVTp2QVTs.CONNECTION_CREATION.println(" EdgeConnection to " + castEdge);
+ for (@NonNull NavigableEdge thatEdge : thoseEdges) {
+ QVTp2QVTs.CONNECTION_CREATION.println(" from " + thatEdge.getRegion() + " : " + thatEdge);
+ }
}
}
}
@@ -1162,7 +1167,10 @@ public abstract class AbstractRegion implements Region, ToDOT.ToDOTable
NodeConnection predicatedConnection = invokingRegion2.getNodeConnection(sourceNodes, classDatumAnalysis);
predicatedConnection.addUsedTargetNode(castTarget, false);
if (QVTp2QVTs.CONNECTION_CREATION.isActive()) {
- QVTp2QVTs.CONNECTION_CREATION.println(" NodeConnection from " + castTarget);
+ QVTp2QVTs.CONNECTION_CREATION.println(" NodeConnection \"" + predicatedConnection + "\" to " + castTarget);
+ for (@NonNull Node sourceNode : sourceNodes) {
+ QVTp2QVTs.CONNECTION_CREATION.println(" from " + sourceNode.getRegion() + " : " + sourceNode);
+ }
}
}
// }
@@ -1218,9 +1226,9 @@ public abstract class AbstractRegion implements Region, ToDOT.ToDOTable
headConnection.addPassedTargetNode(headNode);
}
if (QVTp2QVTs.CONNECTION_CREATION.isActive()) {
- QVTp2QVTs.CONNECTION_CREATION.println((headNode.isDependency() ? " Extra NodeConnection to " : " Head NodeConnection to ") + headNode);
+ QVTp2QVTs.CONNECTION_CREATION.println((headNode.isDependency() ? " Extra NodeConnection " : " Head NodeConnection \"") + headConnection + "\" to " + headNode);
for (@NonNull Node sourceNode : headSources) {
- QVTp2QVTs.CONNECTION_CREATION.println(" from " + sourceNode);
+ QVTp2QVTs.CONNECTION_CREATION.println(" from " + sourceNode.getRegion() + " : " + sourceNode);
}
}
return headConnection;
diff --git a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtp2qvts/BasicMappingRegion.java b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtp2qvts/BasicMappingRegion.java
index 42bd6ec8a..2e88abaf8 100644
--- a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtp2qvts/BasicMappingRegion.java
+++ b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtp2qvts/BasicMappingRegion.java
@@ -337,7 +337,6 @@ public class BasicMappingRegion extends AbstractMappingRegion
Node dependencyHeadNode = RegionUtil.createDependencyNode(this, "«extra-" + (dependencyHeadNodes.size()+1) + "»", classDatumAnalysis);
dependencyHeadNode.setHead();
dependencyHeadNodes.add(dependencyHeadNode);
- addHeadNode(dependencyHeadNode);
return dependencyHeadNode;
}
diff --git a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtp2qvts/ClassDatumAnalysis.java b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtp2qvts/ClassDatumAnalysis.java
index dd965d2d5..2175285bc 100644
--- a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtp2qvts/ClassDatumAnalysis.java
+++ b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtp2qvts/ClassDatumAnalysis.java
@@ -57,6 +57,7 @@ public class ClassDatumAnalysis
protected final @NonNull SchedulerConstants schedulerConstants;
protected final @NonNull ClassDatum classDatum;
+ protected final @NonNull ClassDatum elementalClassDatum;
protected final @NonNull DomainUsage domainUsage;
/**
@@ -74,7 +75,19 @@ public class ClassDatumAnalysis
public ClassDatumAnalysis(@NonNull SchedulerConstants schedulerConstants, @NonNull ClassDatum classDatum) {
this.schedulerConstants = schedulerConstants;
this.classDatum = classDatum;
- this.domainUsage = schedulerConstants.getDomainUsage(ClassUtil.nonNullState(classDatum.getTypedModel()));
+ TypedModel typedModel = ClassUtil.nonNullState(classDatum.getTypedModel());
+ this.domainUsage = schedulerConstants.getDomainUsage(typedModel);
+ Type type = classDatum.getCompleteClass().getPrimaryClass();
+ Type elementType = type;
+ while (elementType instanceof CollectionType) {
+ elementType = ((CollectionType)elementType).getElementType();
+ }
+ if ((elementType == null) || (elementType == type) || !(elementType instanceof org.eclipse.ocl.pivot.Class)) {
+ elementalClassDatum = classDatum;
+ }
+ else {
+ elementalClassDatum = schedulerConstants.getClassDatum((org.eclipse.ocl.pivot.Class)elementType, typedModel);
+ }
}
public void addConsumption(@NonNull MappingRegion consumer, @NonNull Node consumingNode) {
@@ -131,6 +144,10 @@ public class ClassDatumAnalysis
return domainUsage;
}
+ public @NonNull ClassDatum getElementalClassDatum() {
+ return elementalClassDatum;
+ }
+
public @Nullable List<Property> getMultiOpposites() {
List<@NonNull Property> multiOpposites2 = multiOpposites;
if (multiOpposites2 == null) {
diff --git a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtp2qvts/RegionUtil.java b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtp2qvts/RegionUtil.java
index d6c36cf16..d51ad86bf 100644
--- a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtp2qvts/RegionUtil.java
+++ b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtp2qvts/RegionUtil.java
@@ -412,16 +412,17 @@ public class RegionUtil
}
/**
- * Return true if the source of thatEdge is compatible with the source of thisEdge.
+ * Return true if the target of thatEdge is compatible with the target of thisEdge.
*/
- public static boolean isConformantSource(@NonNull NavigableEdge thatEdge, @NonNull NavigableEdge thisEdge) {
- Node thatSource = thatEdge.getSource();
- CompleteClass thatType = thatSource.getCompleteClass();
- CompleteClass thisType = thisEdge.getSource().getCompleteClass();
+ public static boolean isConformantTarget(@NonNull NavigableEdge thatEdge, @NonNull NavigableEdge thisEdge) {
+ Node thatTarget = getCastTarget(thatEdge.getTarget());
+ Node thisTarget = getCastTarget(thisEdge.getTarget());
+ CompleteClass thatType = thatTarget.getCompleteClass();
+ CompleteClass thisType = thisTarget.getCompleteClass();
if (thatType.conformsTo(thisType)) {
return true;
}
- if (thatSource.isRealized()) {
+ if (thatTarget.isRealized()) {
return false;
}
if (thisType.conformsTo(thatType)) {
@@ -431,17 +432,16 @@ public class RegionUtil
}
/**
- * Return true if the target of thatEdge is compatible with the target of thisEdge.
+ * Return true if the elemental source type of thatEdge is compatible with the source type of thisEdge.
*/
- public static boolean isConformantTarget(@NonNull NavigableEdge thatEdge, @NonNull NavigableEdge thisEdge) {
- Node thatTarget = getCastTarget(thatEdge.getTarget());
- Node thisTarget = getCastTarget(thisEdge.getTarget());
- CompleteClass thatType = thatTarget.getCompleteClass();
- CompleteClass thisType = thisTarget.getCompleteClass();
+ public static boolean isElementallyConformantSource(@NonNull NavigableEdge thatEdge, @NonNull NavigableEdge thisEdge) {
+ Node thatSource = thatEdge.getSource();
+ CompleteClass thatType = ClassUtil.nonNullState(thatSource.getClassDatumAnalysis().getElementalClassDatum().getCompleteClass());
+ CompleteClass thisType = ClassUtil.nonNullState(thisEdge.getSource().getClassDatumAnalysis().getElementalClassDatum().getCompleteClass());
if (thatType.conformsTo(thisType)) {
return true;
}
- if (thatTarget.isRealized()) {
+ if (thatSource.isRealized()) {
return false;
}
if (thisType.conformsTo(thatType)) {
@@ -449,7 +449,6 @@ public class RegionUtil
}
return false;
}
-
public static boolean isMatched(@NonNull TypedElement typedElement) {
boolean isMatched = false;
Type type = typedElement.getType();
diff --git a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtp2qvts/RootScheduledRegion.java b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtp2qvts/RootScheduledRegion.java
index 97852c959..4bc6f87c4 100644
--- a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtp2qvts/RootScheduledRegion.java
+++ b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtp2qvts/RootScheduledRegion.java
@@ -1061,7 +1061,7 @@ public class RootScheduledRegion extends AbstractScheduledRegion
assert !producedEdge.isCast(); // Handled by caller
Property property = producedEdge.getProperty();
ClassDatumAnalysis classDatumAnalysis = producedEdge.getSource().getClassDatumAnalysis();
- ClassDatum forwardClassDatum = classDatumAnalysis.getClassDatum();
+ ClassDatum forwardClassDatum = classDatumAnalysis.getElementalClassDatum();
// PropertyDatum forwardPropertyDatum = getSchedulerConstants().getPropertyDatum(forwardClassDatum, property);
// if (forwardPropertyDatum.getClassDatum() == forwardClassDatum) {
// return forwardPropertyDatum;
@@ -1093,7 +1093,7 @@ public class RootScheduledRegion extends AbstractScheduledRegion
}
property = property.getOpposite();
classDatumAnalysis = producedEdge.getTarget().getClassDatumAnalysis();
- ClassDatum reverseClassDatum = classDatumAnalysis.getClassDatum();
+ ClassDatum reverseClassDatum = classDatumAnalysis.getElementalClassDatum();
Iterable<@NonNull PropertyDatum> reversePropertyDatums = getSchedulerConstants().getAllPropertyDatums(reverseClassDatum);
for (PropertyDatum propertyDatum : reversePropertyDatums) {
if ((propertyDatum.getProperty() == property) && (propertyDatum.getClassDatum() == reverseClassDatum)) {
diff --git a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvti/AbstractScheduledRegion2Mapping.java b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvti/AbstractScheduledRegion2Mapping.java
index 70bf47b2c..72b182b95 100644
--- a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvti/AbstractScheduledRegion2Mapping.java
+++ b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvti/AbstractScheduledRegion2Mapping.java
@@ -144,11 +144,11 @@ public abstract class AbstractScheduledRegion2Mapping extends AbstractRegion2Map
else {
throw new UnsupportedOperationException();
/* for (@NonNull Node callingNode : calledGuardNode.getUsedBindingSources()) {
- if (callingNode.getRegion() == region) {
- OCLExpression sourceExpression = createSelectByKind(callingNode);
- mappingParameterBindings.add(helper.createSimpleParameterBinding((SimpleParameter) guardVariable, sourceExpression));
- }
- } */
+ if (callingNode.getRegion() == region) {
+ OCLExpression sourceExpression = createSelectByKind(callingNode);
+ mappingParameterBindings.add(helper.createSimpleParameterBinding((SimpleParameter) guardVariable, sourceExpression));
+ }
+ } */
}
}
}

Back to the top