当前位置: 首页>>代码示例>>Java>>正文


Java MessageScope.Global方法代码示例

本文整理汇总了Java中org.apache.tinkerpop.gremlin.process.computer.MessageScope.Global方法的典型用法代码示例。如果您正苦于以下问题:Java MessageScope.Global方法的具体用法?Java MessageScope.Global怎么用?Java MessageScope.Global使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.tinkerpop.gremlin.process.computer.MessageScope的用法示例。


在下文中一共展示了MessageScope.Global方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: sendMessage

import org.apache.tinkerpop.gremlin.process.computer.MessageScope; //导入方法依赖的package包/类
@Override
public void sendMessage(final MessageScope messageScope, final M message) {
    if (messageScope instanceof MessageScope.Local) {
        final MessageScope.Local<M> localMessageScope = (MessageScope.Local) messageScope;
        final Traversal.Admin<Vertex, Edge> incidentTraversal = GiraphMessenger.setVertexStart(localMessageScope.getIncidentTraversal().get().asAdmin(), this.giraphVertex.getValue().get());
        final Direction direction = GiraphMessenger.getOppositeDirection(incidentTraversal);
        incidentTraversal.forEachRemaining(edge ->
                this.giraphComputation.sendMessage(
                        new ObjectWritable<>(edge.vertices(direction).next().id()),
                        new ObjectWritable<>(localMessageScope.getEdgeFunction().apply(message, edge))));
    } else {
        final MessageScope.Global globalMessageScope = (MessageScope.Global) messageScope;
        globalMessageScope.vertices().forEach(vertex ->
                this.giraphComputation.sendMessage(new ObjectWritable<>(vertex.id()), new ObjectWritable<>(message)));
    }
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:17,代码来源:GiraphMessenger.java

示例2: receiveMessages

import org.apache.tinkerpop.gremlin.process.computer.MessageScope; //导入方法依赖的package包/类
public Stream<M> receiveMessages(MessageScope messageScope) {
    if (messageScope instanceof MessageScope.Global) {
        M message = vertexMemory.getMessage(vertexId,messageScope);
        if (message == null) return Stream.empty();
        else return Stream.of(message);
    } else {
        final MessageScope.Local<M> localMessageScope = (MessageScope.Local) messageScope;
        final Traversal<Vertex, Edge> reverseIncident = FulgoraUtil.getReverseElementTraversal(localMessageScope,vertex,vertex.tx());
        final BiFunction<M,Edge,M> edgeFct = localMessageScope.getEdgeFunction();

        return IteratorUtils.stream(reverseIncident)
                .map(e -> {
                    M msg = vertexMemory.getMessage(vertexMemory.getCanonicalId(((TitanEdge) e).otherVertex(vertex).longId()), localMessageScope);
                    return msg == null ? null : edgeFct.apply(msg, e);
                })
                .filter(m -> m != null);
    }
}
 
开发者ID:graben1437,项目名称:titan1withtp3.1,代码行数:19,代码来源:VertexMemoryHandler.java

示例3: sendMessage

import org.apache.tinkerpop.gremlin.process.computer.MessageScope; //导入方法依赖的package包/类
void sendMessage(long vertexId, M message, MessageScope scope) {
    VertexState<M> state = get(vertexId,true);
    if (scope instanceof MessageScope.Global) state.addMessage(message,GLOBAL_SCOPE,currentScopes,combiner);
    else state.setMessage(message,scope,currentScopes);
}
 
开发者ID:graben1437,项目名称:titan1withtp3.1,代码行数:6,代码来源:FulgoraVertexMemory.java

示例4: normalizeScope

import org.apache.tinkerpop.gremlin.process.computer.MessageScope; //导入方法依赖的package包/类
private static MessageScope normalizeScope(MessageScope scope) {
    if (scope instanceof MessageScope.Global) return GLOBAL_SCOPE;
    else return scope;
}
 
开发者ID:graben1437,项目名称:titan1withtp3.1,代码行数:5,代码来源:FulgoraVertexMemory.java


注:本文中的org.apache.tinkerpop.gremlin.process.computer.MessageScope.Global方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。