aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Dudas2013-03-21 11:17:22 (EDT)
committerZoltan Ujhelyi2013-03-24 15:32:03 (EDT)
commit91fd2ec4eb31dc55aa66e22d2798beff8877c926 (patch)
tree8033463a9f2249d4d3ba4d42cd81875da3212283
parentc812933994df2f35e6e157ea45cc74b4071a74cb (diff)
downloadorg.eclipse.incquery-91fd2ec4eb31dc55aa66e22d2798beff8877c926.zip
org.eclipse.incquery-91fd2ec4eb31dc55aa66e22d2798beff8877c926.tar.gz
org.eclipse.incquery-91fd2ec4eb31dc55aa66e22d2798beff8877c926.tar.bz2
[398720] implement Heath-join and add necessary dependencies
-rw-r--r--plugins/org.eclipse.incquery.runtime.rete/META-INF/MANIFEST.MF3
-rw-r--r--plugins/org.eclipse.incquery.runtime.rete/src/org/eclipse/incquery/runtime/rete/construction/quasitree/JoinCandidate.java33
2 files changed, 20 insertions, 16 deletions
diff --git a/plugins/org.eclipse.incquery.runtime.rete/META-INF/MANIFEST.MF b/plugins/org.eclipse.incquery.runtime.rete/META-INF/MANIFEST.MF
index 0e37fd6..93d79d0 100644
--- a/plugins/org.eclipse.incquery.runtime.rete/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.incquery.runtime.rete/META-INF/MANIFEST.MF
@@ -6,7 +6,8 @@ Bundle-Version: 0.7.0.qualifier
Bundle-Activator: org.eclipse.incquery.runtime.rete.Activator
Bundle-Vendor: Budapest University of Technology and Economics, Fault Tolerant Systems Research Group
Require-Bundle: org.eclipse.core.runtime,
- org.eclipse.incquery.runtime.base.itc;bundle-version="0.7.0";visibility:=reexport
+ org.eclipse.incquery.runtime.base.itc;bundle-version="0.7.0";visibility:=reexport,
+ org.eclipse.incquery.runtime.base;bundle-version="0.7.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
Export-Package: org.eclipse.incquery.runtime.rete.boundary,
diff --git a/plugins/org.eclipse.incquery.runtime.rete/src/org/eclipse/incquery/runtime/rete/construction/quasitree/JoinCandidate.java b/plugins/org.eclipse.incquery.runtime.rete/src/org/eclipse/incquery/runtime/rete/construction/quasitree/JoinCandidate.java
index 8376c6e..9ced7d6 100644
--- a/plugins/org.eclipse.incquery.runtime.rete/src/org/eclipse/incquery/runtime/rete/construction/quasitree/JoinCandidate.java
+++ b/plugins/org.eclipse.incquery.runtime.rete/src/org/eclipse/incquery/runtime/rete/construction/quasitree/JoinCandidate.java
@@ -16,6 +16,7 @@ import java.util.HashMap;
import java.util.Map;
import java.util.Set;
+import org.eclipse.incquery.runtime.base.api.FunctionalDependencyHelper;
import org.eclipse.incquery.runtime.rete.collections.CollectionsFactory;
import org.eclipse.incquery.runtime.rete.construction.Stub;
import org.eclipse.incquery.runtime.rete.construction.psystem.PConstraint;
@@ -40,7 +41,8 @@ class JoinCandidate<StubHandle> {
varPrimary = getPrimary().getVariablesSet();
varSecondary = getSecondary().getVariablesSet();
- varCommon = CollectionsFactory.getSet(varPrimary); varCommon.retainAll(varSecondary);
+ varCommon = CollectionsFactory.getSet(varPrimary);
+ varCommon.retainAll(varSecondary);
}
/**
@@ -94,21 +96,22 @@ class JoinCandidate<StubHandle> {
}
private Boolean heath;
+
// it is a Heath-join iff common variables functionally determine either all primary or all secondary variables
public boolean isHeath() {
- if (heath == null) {
- Map<Set<PVariable>, Set<PVariable>> dependencies = new HashMap<Set<PVariable>, Set<PVariable>>();
- for (PConstraint pConstraint : primary.getAllEnforcedConstraints())
- dependencies.putAll(pConstraint.getFunctionalDependencies());
- for (PConstraint pConstraint : secondary.getAllEnforcedConstraints())
- dependencies.putAll(pConstraint.getFunctionalDependencies());
-
- // TODO use functional dependency analysis to determine heathness here
- // does varCommon determine either varPrimary or varSecondary?
- heath = false;
- }
- return false;
+ if (heath == null) {
+ Map<Set<PVariable>, Set<PVariable>> dependencies = new HashMap<Set<PVariable>, Set<PVariable>>();
+ for (PConstraint pConstraint : primary.getAllEnforcedConstraints())
+ dependencies.putAll(pConstraint.getFunctionalDependencies());
+ for (PConstraint pConstraint : secondary.getAllEnforcedConstraints())
+ dependencies.putAll(pConstraint.getFunctionalDependencies());
+
+ // does varCommon determine either varPrimary or varSecondary?
+ Set<PVariable> varCommonClosure = FunctionalDependencyHelper.closureOf(varCommon, dependencies);
+
+ heath = varCommonClosure.containsAll(varPrimary) || varCommonClosure.containsAll(varSecondary);
+ }
+ return heath;
}
-
-
+
}