Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEd Willink2019-12-03 14:56:21 +0000
committerEd Willink2019-12-03 14:56:21 +0000
commit079854f4e497e4942c04867d35a7d5c9465becfc (patch)
treeb4bdde8e6e443ca88d8c8c9822c59ba241c41612
parent1463af77b5952ef2617095ba70cbd985f046e2e2 (diff)
downloadorg.eclipse.qvtd-079854f4e497e4942c04867d35a7d5c9465becfc.tar.gz
org.eclipse.qvtd-079854f4e497e4942c04867d35a7d5c9465becfc.tar.xz
org.eclipse.qvtd-079854f4e497e4942c04867d35a7d5c9465becfc.zip
ok
-rw-r--r--plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtb2qvts/RuleAnalysis.java4
-rw-r--r--plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtb2qvts/trace/TracedHeadAnalysis.java4
-rw-r--r--plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtr2qvts/RelationAnalysis.java65
-rw-r--r--plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtr2qvts/trace/Relation2TraceClass.java4
-rw-r--r--plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvti/BasicPartition2Mapping.java2
-rw-r--r--plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvts/partitioner/GlobalPredicatePartitionFactory.java2
-rw-r--r--plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvts/partitioner/SpeculatedPartitionFactory.java2
-rw-r--r--plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvts/splitter/SplitterAnalysis.java2
-rw-r--r--plugins/org.eclipse.qvtd.pivot.qvtschedule/emf-gen/org/eclipse/qvtd/pivot/qvtschedule/impl/EdgeImpl.java4
9 files changed, 41 insertions, 48 deletions
diff --git a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtb2qvts/RuleAnalysis.java b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtb2qvts/RuleAnalysis.java
index 78de905ef..f5a33d346 100644
--- a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtb2qvts/RuleAnalysis.java
+++ b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtb2qvts/RuleAnalysis.java
@@ -177,11 +177,11 @@ public abstract class RuleAnalysis extends RegionHelper<@NonNull RuleRegion>
//
boolean allMatched = false; // True if all outgoing edges of sourceNode are matched.
Node sourceNode = QVTscheduleUtil.getSourceNode(edge);
- if (sourceNode.isMatched()) {
+ if (!sourceNode.isConditional()) {
allMatched = true;
for (@NonNull Edge outgoingEdge : QVTscheduleUtil.getOutgoingEdges(sourceNode)) {
Node targetNode = QVTscheduleUtil.getTargetNode(outgoingEdge);
- if (!targetNode.isMatched()) {
+ if (targetNode.isConditional()) {
allMatched = false;
break;
}
diff --git a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtb2qvts/trace/TracedHeadAnalysis.java b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtb2qvts/trace/TracedHeadAnalysis.java
index 4af92f10a..f6bc07f82 100644
--- a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtb2qvts/trace/TracedHeadAnalysis.java
+++ b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtb2qvts/trace/TracedHeadAnalysis.java
@@ -101,7 +101,7 @@ public class TracedHeadAnalysis extends HeadAnalysis
private @NonNull Map<@NonNull Node, @NonNull Set<@NonNull Node>> computeTracedTargetFromSources() {
Map<@NonNull Node, @NonNull Set<@NonNull Node>> targetFromSources = new HashMap<>();
for (@NonNull Node targetNode : QVTscheduleUtil.getOwnedNodes(mappingRegion)) {
- if (targetNode.isMatched() && !targetNode.isConstant()) {
+ if (!targetNode.isConditional() && !targetNode.isConstant()) {
ClassDatum classDatum = QVTscheduleUtil.getClassDatum(targetNode);
TypedModel typedModel = QVTscheduleUtil.getReferredTypedModel(classDatum);
if (!typedModel.isIsTrace()) { // when/where invocation nodes are not part of the multi-sided trace
@@ -112,7 +112,7 @@ public class TracedHeadAnalysis extends HeadAnalysis
}
for (@NonNull Edge edge : QVTscheduleUtil.getIncomingEdges(targetNode)) {
Node sourceNode = edge.getEdgeSource();
- if (sourceNode.isMatched() && !sourceNode.isConstant()) {
+ if (!sourceNode.isConditional() && !sourceNode.isConstant()) {
if (edge instanceof NavigationEdge) {
if (!((NavigationEdge)edge).isPartial()) {
sources.add(sourceNode);
diff --git a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtr2qvts/RelationAnalysis.java b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtr2qvts/RelationAnalysis.java
index 03d39cca2..983ad183e 100644
--- a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtr2qvts/RelationAnalysis.java
+++ b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtr2qvts/RelationAnalysis.java
@@ -787,6 +787,29 @@ public class RelationAnalysis extends RuleAnalysis
public @NonNull QVTrelationNameGenerator getNameGenerator() {
return (QVTrelationNameGenerator) super.getNameGenerator();
}
+ /**
+ * Return the utility for a give variableDeclaration adjusting the optional multiplicity of the heads an optional
+ * when invocation to non-optional. (See Bug 499432)
+ */
+ private @NonNull InitUtility getOptionallyMatchAtRootUtility(@NonNull VariableDeclaration variableDeclaration) {
+ boolean anyRequired = false;
+ boolean isRootVariable = false;
+ for (@NonNull VariableDeclaration rootVariable : QVTrelationUtil.getRootVariables(getRule())) {
+ if (rootVariable == variableDeclaration) {
+ isRootVariable = true;
+ }
+ if (rootVariable.isIsRequired()) {
+ anyRequired = true;
+ }
+ }
+ if (!isRootVariable) { // Non-root is not
+ return InitUtility.getRequiredInitUtility(variableDeclaration); // a root match
+ }
+ if (anyRequired) { // If any root cannot be null
+ return InitUtility.getRequiredInitUtility(variableDeclaration); // a match is required
+ }
+ return InitUtility.NON_NULL_MATCHED; // Match can be omitted
+ }
public @NonNull InvocationAnalysis getOutgoingInvocationAnalysis(@NonNull RelationAnalysis invokedRelationAnalysis, @NonNull RelationCallExp invocation, boolean isWhen, @NonNull InitUtility initUtility,
@NonNull Map<@NonNull VariableDeclaration, @NonNull Node> rootVariable2argumentNode) {
@@ -1889,12 +1912,8 @@ public class RelationAnalysis extends RuleAnalysis
createOldNode(InitUtility.getRequiredInitUtility(variableDeclaration), variableDeclaration); // where 'output' is created by invoker
}
else if (getRealizedOutputVariables().contains(variableDeclaration)) {
- if (isOptionallyMatchedAtRoot(variableDeclaration)) {
- createRealizedStepNode(InitUtility.NON_NULL_MATCHED, variableDeclaration);
- }
- else {
- createRealizedStepNode(InitUtility.getRequiredInitUtility(variableDeclaration), variableDeclaration);
- }
+ InitUtility utility = getOptionallyMatchAtRootUtility(variableDeclaration);
+ createRealizedStepNode(utility, variableDeclaration);
}
else {
if (variableDeclaration instanceof TemplateVariable) {
@@ -1904,12 +1923,8 @@ public class RelationAnalysis extends RuleAnalysis
return; // CollectionTemplateExp variables would be bloat
// }
}
- if (isOptionallyMatchedAtRoot(variableDeclaration)) {
- createOldNode(InitUtility.NON_NULL_MATCHED, variableDeclaration); // FIXME allow nullable
- }
- else {
- createOldNode(InitUtility.getRequiredInitUtility(variableDeclaration), variableDeclaration);
- }
+ InitUtility utility = getOptionallyMatchAtRootUtility(variableDeclaration);
+ createOldNode(utility, variableDeclaration);
}
else if (variableDeclaration instanceof SharedVariable) {
SharedVariable sharedVariable = (SharedVariable)variableDeclaration;
@@ -1921,34 +1936,12 @@ public class RelationAnalysis extends RuleAnalysis
}
}
else {
- createOldNode(InitUtility.getRequiredInitUtility(variableDeclaration), variableDeclaration); // Never happens
+ InitUtility utility = getOptionallyMatchAtRootUtility(variableDeclaration);
+ createOldNode(utility, variableDeclaration); // Never happens
}
}
}
- /**
- * Return true unless a non-match is permitted for null input to null output. (See Bug 499432)
- * @param variableDeclaration
- */
- public boolean isOptionallyMatchedAtRoot(@NonNull VariableDeclaration variableDeclaration) {
- boolean anyRequired = false;
- boolean isRootVariable = false;
- for (@NonNull VariableDeclaration rootVariable : QVTrelationUtil.getRootVariables(getRule())) {
- if (rootVariable == variableDeclaration) {
- isRootVariable = true;
- }
- if (rootVariable.isIsRequired()) {
- anyRequired = true;
- }
- }
- if (!isRootVariable) { // Non-root is not
- return false; // a root match
- }
- if (anyRequired) { // If any root cannot be null
- return false; // a match is required
- }
- return true; // Match can be omitted
- }
protected boolean synthesizeVariableEqualsPredicate(@NonNull VariableDeclaration variable, @NonNull OCLExpression valueExp) {
Node variableNode = region.getNode(variable);
diff --git a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtr2qvts/trace/Relation2TraceClass.java b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtr2qvts/trace/Relation2TraceClass.java
index 0920bca14..18906b752 100644
--- a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtr2qvts/trace/Relation2TraceClass.java
+++ b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtr2qvts/trace/Relation2TraceClass.java
@@ -138,10 +138,10 @@ public class Relation2TraceClass extends AbstractRelation2MiddleType
if (node.isThis()) {
; // Do not trace this
}
- else if (node.isPattern() && node.isMatched()) {
+ else if (node.isPattern() && !node.isConditional()) {
createVariableDeclaration2TraceProperty(node, rootVariables, allHeadGroupNodes, manyTracesPerHead);
}
- else if (/*node.isPattern() &&*/ node.isMatched() && !node.isConstant()) {
+ else if (/*node.isPattern() &&*/ !node.isConditional() && !node.isConstant()) {
createVariableDeclaration2TraceProperty(node, rootVariables, allHeadGroupNodes, manyTracesPerHead);
}
}
diff --git a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvti/BasicPartition2Mapping.java b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvti/BasicPartition2Mapping.java
index 1fa809ed8..b3380786c 100644
--- a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvti/BasicPartition2Mapping.java
+++ b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvti/BasicPartition2Mapping.java
@@ -578,7 +578,7 @@ public class BasicPartition2Mapping extends AbstractPartition2Mapping
private @NonNull DeclareStatement createDeclareStatement(@NonNull Node node, @NonNull OCLExpression initExpression) {
Type variableType = node.getClassDatum().getPrimaryClass();
assert variableType != null;
- boolean isRequired = node.isMatched() && node.isRequired();
+ boolean isRequired = !node.isConditional() && node.isRequired();
if (initExpression.isIsRequired()) {
isRequired = true;
}
diff --git a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvts/partitioner/GlobalPredicatePartitionFactory.java b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvts/partitioner/GlobalPredicatePartitionFactory.java
index 60147ba82..551429524 100644
--- a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvts/partitioner/GlobalPredicatePartitionFactory.java
+++ b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvts/partitioner/GlobalPredicatePartitionFactory.java
@@ -257,7 +257,7 @@ public class GlobalPredicatePartitionFactory extends AbstractSimplePartitionFact
protected void resolvePredicatedMiddleNodes(@NonNull BasicPartition partition) {
for (@NonNull Node node : mappingPartitioner.getPredicatedMiddleNodes()) {
- if (!partition.hasNode(node) && node.isMatched()) { // && mappingPartitioner.isCyclic(node)) {
+ if (!partition.hasNode(node) && !node.isConditional()) { // && mappingPartitioner.isCyclic(node)) {
Role nodeRole = QVTscheduleUtil.getNodeRole(node);
// if (node.isPattern() && node.isClass()) {
// nodeRole = QVTscheduleUtil.asSpeculated(nodeRole);
diff --git a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvts/partitioner/SpeculatedPartitionFactory.java b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvts/partitioner/SpeculatedPartitionFactory.java
index 16ceac222..898a30bd5 100644
--- a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvts/partitioner/SpeculatedPartitionFactory.java
+++ b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvts/partitioner/SpeculatedPartitionFactory.java
@@ -181,7 +181,7 @@ public class SpeculatedPartitionFactory extends AbstractSimplePartitionFactory
}*/
protected void resolveTraceNodes(@NonNull BasicPartition partition, @NonNull Node traceNode) {
- assert traceNode.isMatched() && traceNode.isClass() && traceNode.isPattern();
+ assert !traceNode.isConditional() && traceNode.isClass() && traceNode.isPattern();
addNode(partition, traceNode, Role.PREDICATED);
if (scheduleManager.useActivators()) {
Node localSuccessNode = mappingPartitioner.basicGetLocalSuccessNode(traceNode);
diff --git a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvts/splitter/SplitterAnalysis.java b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvts/splitter/SplitterAnalysis.java
index 173756b51..a546ce625 100644
--- a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvts/splitter/SplitterAnalysis.java
+++ b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvts/splitter/SplitterAnalysis.java
@@ -52,7 +52,7 @@ class SplitterAnalysis
//
List<@NonNull Node> headNodes = new ArrayList<>();
for (@NonNull Node headNode : QVTscheduleUtil.getHeadNodes(region)) {
- if (headNode.isMatched()) { // Ignore extra heads
+ if (!headNode.isConditional()) { // Ignore extra heads
headNodes.add(headNode);
}
}
diff --git a/plugins/org.eclipse.qvtd.pivot.qvtschedule/emf-gen/org/eclipse/qvtd/pivot/qvtschedule/impl/EdgeImpl.java b/plugins/org.eclipse.qvtd.pivot.qvtschedule/emf-gen/org/eclipse/qvtd/pivot/qvtschedule/impl/EdgeImpl.java
index ab6b1e1b8..9a284efeb 100644
--- a/plugins/org.eclipse.qvtd.pivot.qvtschedule/emf-gen/org/eclipse/qvtd/pivot/qvtschedule/impl/EdgeImpl.java
+++ b/plugins/org.eclipse.qvtd.pivot.qvtschedule/emf-gen/org/eclipse/qvtd/pivot/qvtschedule/impl/EdgeImpl.java
@@ -839,8 +839,8 @@ public abstract class EdgeImpl extends ElementImpl implements Edge {
@Override
public final boolean isMatched() {
- boolean matchedSource = QVTscheduleUtil.getSourceNode(this).isMatched();
- boolean matchedTarget = QVTscheduleUtil.getTargetNode(this).isMatched();
+ boolean matchedSource = !QVTscheduleUtil.getSourceNode(this).isConditional();
+ boolean matchedTarget = !QVTscheduleUtil.getTargetNode(this).isConditional();
boolean utilityMatched = initUtility.isUnconditional();
return matchedSource && matchedTarget;
}

Back to the top