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 2015/05/26 22:12:45 UTC
incubator-tinkerpop git commit: SelectStep now uses
Scope.getScopeValueByKey() helper method.
Repository: incubator-tinkerpop
Updated Branches:
refs/heads/master bdd23a8eb -> ea509aa64
SelectStep now uses Scope.getScopeValueByKey() helper method.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/ea509aa6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/ea509aa6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/ea509aa6
Branch: refs/heads/master
Commit: ea509aa64c1084f3dbdbd4c1a5884089baf9259e
Parents: bdd23a8
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Tue May 26 14:12:55 2015 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Tue May 26 14:12:55 2015 -0600
----------------------------------------------------------------------
.../process/traversal/step/map/SelectStep.java | 23 ++++++++++----------
1 file changed, 12 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/ea509aa6/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/SelectStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/SelectStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/SelectStep.java
index 3ee3b42..77c0174 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/SelectStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/SelectStep.java
@@ -30,7 +30,11 @@ import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalRing;
import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalUtil;
import org.apache.tinkerpop.gremlin.structure.util.StringFactory;
-import java.util.*;
+import java.util.Arrays;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
/**
* @author Marko A. Rodriguez (http://markorodriguez.com)
@@ -52,18 +56,15 @@ public final class SelectStep<S, E> extends MapStep<S, Map<String, E>> implement
final S start = traverser.get();
final Map<String, E> bindings = new LinkedHashMap<>();
- if (Scope.local == this.scope) {
- if (this.selectLabels.isEmpty())
+ if (this.selectLabels.isEmpty()) {
+ if (Scope.local == this.scope)
((Map<String, Object>) start).forEach((key, value) -> bindings.put(key, (E) TraversalUtil.apply(value, this.traversalRing.next())));
- else
- this.selectLabels.forEach(label -> bindings.put(label, (E) TraversalUtil.apply(((Map) start).get(label), this.traversalRing.next())));
- } else {
- final Path path = traverser.path();
- if (this.selectLabels.isEmpty())
+ else {
+ final Path path = traverser.path();
path.labels().stream().flatMap(Set::stream).distinct().forEach(label -> bindings.put(label, (E) TraversalUtil.apply(path.<Object>get(label), this.traversalRing.next())));
- else
- this.selectLabels.forEach(label -> bindings.put(label, (E) TraversalUtil.apply(path.<Object>get(label), this.traversalRing.next())));
- }
+ }
+ } else
+ this.selectLabels.forEach(label -> bindings.put(label, (E) TraversalUtil.apply((Object) Scope.getScopeValueByKey(this.scope, label, traverser), this.traversalRing.next())));
this.traversalRing.reset();
return bindings;