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


Java Event.EdgeAddedEvent方法代码示例

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


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

示例1: processNextStart

import org.apache.tinkerpop.gremlin.process.traversal.step.util.event.Event; //导入方法依赖的package包/类
@Override
protected Traverser.Admin<Edge> processNextStart() {
    if (this.first) {
        this.first = false;
        final TraverserGenerator generator = this.getTraversal().getTraverserGenerator();
        final Traverser.Admin traverser = generator.generate(1, (Step) this, 1); // a dead traverser to trigger the traversal
        Vertex toVertex = (Vertex) this.parameters.get(traverser, TO, Collections::emptyList).get(0);
        Vertex fromVertex = (Vertex) this.parameters.get(traverser, FROM, Collections::emptyList).get(0);
        if (toVertex instanceof Attachable)
            toVertex = ((Attachable<Vertex>) toVertex)
                    .attach(Attachable.Method.get(this.getTraversal().getGraph().orElse(EmptyGraph.instance())));
        if (fromVertex instanceof Attachable)
            fromVertex = ((Attachable<Vertex>) fromVertex)
                    .attach(Attachable.Method.get(this.getTraversal().getGraph().orElse(EmptyGraph.instance())));
        final String edgeLabel = (String) this.parameters.get(traverser, T.label, () -> Edge.DEFAULT_LABEL).get(0);
        final Edge edge = fromVertex.addEdge(edgeLabel, toVertex, this.parameters.getKeyValues(traverser, TO, FROM, T.label));
        if (callbackRegistry != null) {
            final Event.EdgeAddedEvent vae = new Event.EdgeAddedEvent(DetachedFactory.detach(edge, true));
            callbackRegistry.getCallbacks().forEach(c -> c.accept(vae));
        }
        return generator.generate(edge, this, 1L);
    } else
        throw FastNoSuchElementException.instance();


}
 
开发者ID:apache,项目名称:tinkerpop,代码行数:27,代码来源:AddEdgeStartStep.java

示例2: map

import org.apache.tinkerpop.gremlin.process.traversal.step.util.event.Event; //导入方法依赖的package包/类
@Override
protected Edge map(final Traverser.Admin<S> traverser) {
    Vertex toVertex = this.parameters.get(traverser, TO, () -> (Vertex) traverser.get()).get(0);
    Vertex fromVertex = this.parameters.get(traverser, FROM, () -> (Vertex) traverser.get()).get(0);
    if (toVertex instanceof Attachable)
        toVertex = ((Attachable<Vertex>) toVertex)
                .attach(Attachable.Method.get(this.getTraversal().getGraph().orElse(EmptyGraph.instance())));
    if (fromVertex instanceof Attachable)
        fromVertex = ((Attachable<Vertex>) fromVertex)
                .attach(Attachable.Method.get(this.getTraversal().getGraph().orElse(EmptyGraph.instance())));
    final String edgeLabel = this.parameters.get(traverser, T.label, () -> Edge.DEFAULT_LABEL).get(0);

    final Edge edge = fromVertex.addEdge(edgeLabel, toVertex, this.parameters.getKeyValues(traverser, TO, FROM, T.label));
    if (callbackRegistry != null) {
        final EventStrategy eventStrategy = getTraversal().getStrategies().getStrategy(EventStrategy.class).get();
        final Event.EdgeAddedEvent vae = new Event.EdgeAddedEvent(eventStrategy.detach(edge));
        callbackRegistry.getCallbacks().forEach(c -> c.accept(vae));
    }
    return edge;
}
 
开发者ID:apache,项目名称:tinkerpop,代码行数:21,代码来源:AddEdgeStep.java

示例3: map

import org.apache.tinkerpop.gremlin.process.traversal.step.util.event.Event; //导入方法依赖的package包/类
@Override
protected Edge map(final Traverser.Admin<S> traverser) {
    final Vertex toVertex = this.parameters.get(traverser, TO, () -> (Vertex) traverser.get()).get(0);
    final Vertex fromVertex = this.parameters.get(traverser, FROM, () -> (Vertex) traverser.get()).get(0);
    final String edgeLabel = this.parameters.get(traverser, T.label, () -> Edge.DEFAULT_LABEL).get(0);

    final Edge edge = fromVertex.addEdge(edgeLabel, toVertex, this.parameters.getKeyValues(traverser, TO, FROM, T.label));
        if (callbackRegistry != null) {
            final Event.EdgeAddedEvent vae = new Event.EdgeAddedEvent(DetachedFactory.detach(edge, true));
            callbackRegistry.getCallbacks().forEach(c -> c.accept(vae));
        }
    return edge;
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:14,代码来源:AddEdgeStep.java

示例4: getMutatingCallbackRegistry

import org.apache.tinkerpop.gremlin.process.traversal.step.util.event.Event; //导入方法依赖的package包/类
@Override
public CallbackRegistry<Event.EdgeAddedEvent> getMutatingCallbackRegistry() {
    if (null == this.callbackRegistry) this.callbackRegistry = new ListCallbackRegistry<>();
    return this.callbackRegistry;
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:6,代码来源:AddEdgeStep.java


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