com.tinkerpop.gremlin.tinkergraph.process.computer.TinkerMessenger Maven / Gradle / Ivy
package com.tinkerpop.gremlin.tinkergraph.process.computer;
import com.tinkerpop.gremlin.process.computer.MessageCombiner;
import com.tinkerpop.gremlin.process.computer.MessageType;
import com.tinkerpop.gremlin.process.computer.Messenger;
import com.tinkerpop.gremlin.structure.Edge;
import com.tinkerpop.gremlin.structure.Vertex;
import com.tinkerpop.gremlin.util.StreamFactory;
import java.util.Arrays;
import java.util.Optional;
import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedQueue;
/**
* @author Marko A. Rodriguez (http://markorodriguez.com)
*/
public class TinkerMessenger implements Messenger {
private final Vertex vertex;
private final TinkerMessageBoard messageBoard;
private final Optional> combiner;
public TinkerMessenger(final Vertex vertex, final TinkerMessageBoard messageBoard, final Optional> combiner) {
this.vertex = vertex;
this.messageBoard = messageBoard;
this.combiner = combiner;
}
@Override
public Iterable receiveMessages(final MessageType messageType) {
if (messageType instanceof MessageType.Local) {
final MessageType.Local