Repository: tinkerpop
Updated Branches:
  refs/heads/tp32 81e6ba6fc -> 6fbf13047


TinkerMessenger proper handling of Direction.BOTH


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/f02ea338
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/f02ea338
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/f02ea338

Branch: refs/heads/tp32
Commit: f02ea338a8d039c50896f7c65ca57a695975fc43
Parents: 072f112
Author: Graff, Philip B <philip.gr...@jhuapl.edu>
Authored: Thu Jan 4 13:27:44 2018 -0500
Committer: Graff, Philip B <philip.gr...@jhuapl.edu>
Committed: Sun Feb 25 10:43:57 2018 -0500

----------------------------------------------------------------------
 .../tinkergraph/process/computer/TinkerMessenger.java    | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f02ea338/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/process/computer/TinkerMessenger.java
----------------------------------------------------------------------
diff --git 
a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/process/computer/TinkerMessenger.java
 
b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/process/computer/TinkerMessenger.java
index 5a0f478..3e49c34 100644
--- 
a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/process/computer/TinkerMessenger.java
+++ 
b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/process/computer/TinkerMessenger.java
@@ -68,7 +68,16 @@ public final class TinkerMessenger<M> implements 
Messenger<M> {
                 final Direction direction = 
TinkerMessenger.getDirection(incidentTraversal);
                 final Edge[] edge = new Edge[1]; // simulates storage 
side-effects available in Gremlin, but not Java8 streams
                 
multiIterator.addIterator(StreamSupport.stream(Spliterators.spliteratorUnknownSize(VertexProgramHelper.reverse(incidentTraversal.asAdmin()),
 Spliterator.IMMUTABLE | Spliterator.SIZED), false)
-                        .map(e -> 
this.messageBoard.receiveMessages.get(messageScope).get((edge[0] = 
e).vertices(direction).next()))
+                        .map((Edge e) -> {
+                            edge[0] = e;
+                            Vertex vv;
+                            if (direction.equals(Direction.IN) || 
direction.equals(Direction.OUT)) {
+                                vv = e.vertices(direction).next();
+                            } else {
+                                vv = e.outVertex() == this.vertex ? 
e.inVertex() : e.outVertex();
+                            }
+                            return 
this.messageBoard.receiveMessages.get(messageScope).get(vv);
+                        })
                         .filter(q -> null != q)
                         .flatMap(Queue::stream)
                         .map(message -> 
localMessageScope.getEdgeFunction().apply(message, edge[0]))

Reply via email to