aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarton Bur2014-07-09 04:29:42 (EDT)
committerMarton Bur2014-07-09 04:29:42 (EDT)
commit9758392d3a793de375d279e9ffb3e88e1ef71229 (patch)
tree75cad37e8f537c1c94422e4d811983cb86539e11
parent71a5b4fdb7ae35c594c90e29f8786d728981cdc3 (diff)
downloadorg.eclipse.incquery-9758392d3a793de375d279e9ffb3e88e1ef71229.zip
org.eclipse.incquery-9758392d3a793de375d279e9ffb3e88e1ef71229.tar.gz
org.eclipse.incquery-9758392d3a793de375d279e9ffb3e88e1ef71229.tar.bz2
[431204] Changed the flattened PDisjunction creation locationrefs/changes/52/29652/1
Change-Id: I19d199c7f317c7529b6d5dd2e0a3470da812b8fd Signed-off-by: Marton Bur <marton.bur@gmail.com>
-rw-r--r--plugins/org.eclipse.incquery.runtime.matchers/src/org/eclipse/incquery/runtime/matchers/psystem/rewriters/PQueryFlattener.java18
1 files changed, 8 insertions, 10 deletions
diff --git a/plugins/org.eclipse.incquery.runtime.matchers/src/org/eclipse/incquery/runtime/matchers/psystem/rewriters/PQueryFlattener.java b/plugins/org.eclipse.incquery.runtime.matchers/src/org/eclipse/incquery/runtime/matchers/psystem/rewriters/PQueryFlattener.java
index e0e3cef..cc5ffad 100644
--- a/plugins/org.eclipse.incquery.runtime.matchers/src/org/eclipse/incquery/runtime/matchers/psystem/rewriters/PQueryFlattener.java
+++ b/plugins/org.eclipse.incquery.runtime.matchers/src/org/eclipse/incquery/runtime/matchers/psystem/rewriters/PQueryFlattener.java
@@ -74,8 +74,7 @@ public class PQueryFlattener extends PDisjunctionRewriter {
Set<PBody> flattenedBodies = Sets.<PBody>newHashSet();
for (PBody pBody : bodies) {
// OR connection between the bodies
- PDisjunction flattenedDisjunction = doFlatten(pBody);
- flattenedBodies.addAll(flattenedDisjunction.getBodies());
+ flattenedBodies.addAll(doFlatten(pBody));
}
return new PDisjunction(pQuery, flattenedBodies);
}
@@ -89,11 +88,10 @@ public class PQueryFlattener extends PDisjunctionRewriter {
* @return the flattened equivalent of the given pBody
* @throws Exception
*/
- private PDisjunction doFlatten(PBody pBody) throws Exception {
-
+ private Set<PBody> doFlatten(PBody pBody) throws Exception {
Set<PConstraint> constraints = pBody.getConstraints();
-
+
// If the received pBody should not be flattened, return it alone.
if (!isFlatteningNeeded(constraints)) {
return prepareFlatPBody(pBody);
@@ -128,7 +126,7 @@ public class PQueryFlattener extends PDisjunctionRewriter {
* @param flattenedCalls
* @return
*/
- private PDisjunction createFlatPDisjunction(PBody pBody, List<PDisjunction> flattenedDisjunctions, List<PositivePatternCall> flattenedCalls) {
+ private Set<PBody> createFlatPDisjunction(PBody pBody, List<PDisjunction> flattenedDisjunctions, List<PositivePatternCall> flattenedCalls) {
PQuery pQuery = pBody.getPattern();
// The members of this set are sets containing bodies in disjunction
@@ -154,15 +152,15 @@ public class PQueryFlattener extends PDisjunctionRewriter {
}
// Create a new (flattened) PDisjunction referring to the corresponding query and return it
- return new PDisjunction(pBody.getPattern(),conjunctedBodies);
+ return conjunctedBodies;
}
- private PDisjunction prepareFlatPBody(PBody pBody) {
+ private Set<PBody> prepareFlatPBody(PBody pBody) {
Set<PBody> bodySet = Sets.newHashSet();
// Copy here with hierarchical variable renaming
FlattenerCopier flattenerCopier = copyBody(pBody, new HierarchicalName());
bodySet.add(flattenerCopier.getCopiedBody());
- return new PDisjunction(pBody.getPattern(), bodySet);
+ return bodySet;
}
private boolean isFlatteningNeeded(Set<PConstraint> constraints) {
@@ -200,7 +198,7 @@ public class PQueryFlattener extends PDisjunctionRewriter {
}
return result;
}
-
+
/**
* Helper function to copy a PBody object. Creates a new copier.
*