You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by ok...@apache.org on 2016/09/26 15:43:15 UTC
tinkerpop git commit: per @spmallettes request -- added JavaDoc to
InlineFilter'Strategy. Also,
used the new TraversalHelper.copyLabels() method in InlineFilterStrategy.
Repository: tinkerpop
Updated Branches:
refs/heads/TINKERPOP-1456 be990d421 -> a49213fbd
per @spmallettes request -- added JavaDoc to InlineFilter'Strategy. Also, used the new TraversalHelper.copyLabels() method in InlineFilterStrategy.
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/a49213fb
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/a49213fb
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/a49213fb
Branch: refs/heads/TINKERPOP-1456
Commit: a49213fbd9181b6006ea46e465ed2a0376861682
Parents: be990d4
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Mon Sep 26 09:43:04 2016 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Mon Sep 26 09:43:04 2016 -0600
----------------------------------------------------------------------
.../optimization/InlineFilterStrategy.java | 20 ++++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a49213fb/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/InlineFilterStrategy.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/InlineFilterStrategy.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/InlineFilterStrategy.java
index 0944361..ba2f832 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/InlineFilterStrategy.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/InlineFilterStrategy.java
@@ -35,7 +35,17 @@ import java.util.List;
import java.util.Set;
/**
+ * InlineFilterStrategy analyzes filter-steps with child traversals that themselves are pure filters.
+ * If the child traversals are pure filters then the wrapping parent filter is not needed and thus, the
+ * children can be "inlined."
+ * <p/>
+ *
* @author Marko A. Rodriguez (http://markorodriguez.com)
+ * @example <pre>
+ * __.filter(has("name","marko")) // is replaced by __.has("name","marko")
+ * __.and(has("name"),has("age")) // is replaced by __.has("name").has("age")
+ * __.and(filter(has("name","marko").has("age")),hasNot("blah")) // is replaced by __.has("name","marko").has("age").hasNot("blah")
+ * </pre>
*/
public final class InlineFilterStrategy extends AbstractTraversalStrategy<TraversalStrategy.OptimizationStrategy> implements TraversalStrategy.OptimizationStrategy {
@@ -59,10 +69,8 @@ public final class InlineFilterStrategy extends AbstractTraversalStrategy<Traver
TraversalHelper.applySingleLevelStrategies(traversal, childTraversal, InlineFilterStrategy.class);
final Step<?, ?> finalStep = childTraversal.getEndStep();
TraversalHelper.insertTraversal((Step) step, childTraversal, traversal);
+ TraversalHelper.copyLabels(step, finalStep, false);
traversal.removeStep(step);
- for (final String label : step.getLabels()) {
- finalStep.addLabel(label);
- }
}
}
for (final AndStep<?> step : TraversalHelper.getStepsOfAssignableClass(AndStep.class, traversal)) {
@@ -78,12 +86,8 @@ public final class InlineFilterStrategy extends AbstractTraversalStrategy<Traver
TraversalHelper.insertTraversal((Step) step, childTraversals.get(i), traversal);
}
+ if (null != finalStep) TraversalHelper.copyLabels(step, finalStep, false);
traversal.removeStep(step);
- if (null != finalStep) {
- for (final String label : step.getLabels()) {
- finalStep.addLabel(label);
- }
- }
}
}
}