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


Java MemoryTraversalSideEffects.setMemorySideEffects方法代码示例

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


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

示例1: terminate

import org.apache.tinkerpop.gremlin.process.computer.traversal.MemoryTraversalSideEffects; //导入方法依赖的package包/类
@Override
public boolean terminate(final Memory memory) {
    final TraverserGenerator generator = this.traversal.get().getTraverserGenerator();
    MemoryTraversalSideEffects.setMemorySideEffects(this.traversal.get(), memory, ProgramPhase.TERMINATE);
    checkSideEffects();
    if (memory.isInitialIteration()) {
        assertFalse(memory.exists(TraversalVertexProgram.HALTED_TRAVERSERS));
        return false;
    } else {
        ///
        assertTrue(memory.exists(TraversalVertexProgram.HALTED_TRAVERSERS));
        final TraverserSet<String> haltedTraversers = memory.get(TraversalVertexProgram.HALTED_TRAVERSERS);
        haltedTraversers.add(generator.generate("hello", this.programStep, 1l));
        haltedTraversers.add(generator.generate("gremlin", this.programStep, 1l));
        memory.set(TraversalVertexProgram.HALTED_TRAVERSERS, haltedTraversers);
        return true;
    }
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:19,代码来源:ProgramTest.java

示例2: setup

import org.apache.tinkerpop.gremlin.process.computer.traversal.MemoryTraversalSideEffects; //导入方法依赖的package包/类
@Override
public void setup(final Memory memory) {
    MemoryTraversalSideEffects.setMemorySideEffects(this.traversal.get(), memory, ProgramPhase.SETUP);
    final Map<Vertex, Long> map = (Map<Vertex, Long>) this.haltedTraversers.iterator().next().get();
    assertEquals(2, map.size());
    assertTrue(map.values().contains(3l));
    assertTrue(map.values().contains(1l));
    final TraverserSet<Object> activeTraversers = new TraverserSet<>();
    map.keySet().forEach(vertex -> activeTraversers.add(this.haltedTraversers.peek().split(vertex, EmptyStep.instance())));
    this.haltedTraversers.clear();
    this.checkSideEffects();
    memory.set(TraversalVertexProgram.ACTIVE_TRAVERSERS, activeTraversers);


}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:16,代码来源:ProgramTest.java

示例3: execute

import org.apache.tinkerpop.gremlin.process.computer.traversal.MemoryTraversalSideEffects; //导入方法依赖的package包/类
@Override
public void execute(final Vertex vertex, final Messenger messenger, final Memory memory) {
    assertFalse(memory.exists(TraversalVertexProgram.HALTED_TRAVERSERS));
    final TraverserGenerator generator = this.traversal.get().getTraverserGenerator();
    MemoryTraversalSideEffects.setMemorySideEffects(this.traversal.get(), memory, ProgramPhase.EXECUTE);
    this.checkSideEffects();
    final TraverserSet<Vertex> activeTraversers = memory.get(TraversalVertexProgram.ACTIVE_TRAVERSERS);
    if (vertex.label().equals("software")) {
        assertEquals(1, activeTraversers.stream().filter(v -> v.get().equals(vertex)).count());
        if (memory.isInitialIteration()) {
            assertFalse(vertex.property(TraversalVertexProgram.HALTED_TRAVERSERS).isPresent());
            vertex.property(
                    TraversalVertexProgram.HALTED_TRAVERSERS,
                    new TraverserSet<>(generator.generate(vertex.value("name"), this.programStep, 1l)));
        } else {
            assertTrue(vertex.property(TraversalVertexProgram.HALTED_TRAVERSERS).isPresent());
        }
    } else {
        assertFalse(vertex.property(TraversalVertexProgram.HALTED_TRAVERSERS).isPresent());
        assertEquals(0, activeTraversers.stream().filter(v -> v.get().equals(vertex)).count());
        if (!memory.isInitialIteration()) {
            if (vertex.value("name").equals("marko"))
                memory.add(TraversalVertexProgram.HALTED_TRAVERSERS, new TraverserSet<>(generator.generate("marko-is-my-name", this.programStep, 1l)));
            else if (vertex.value("name").equals("vadas"))
                this.traversal.get().getSideEffects().add(TraversalVertexProgram.HALTED_TRAVERSERS, new TraverserSet<>(generator.generate("the-v-o-double-g", this.programStep, 1l)));
        }
    }
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:29,代码来源:ProgramTest.java

示例4: workerIterationStart

import org.apache.tinkerpop.gremlin.process.computer.traversal.MemoryTraversalSideEffects; //导入方法依赖的package包/类
@Override
public void workerIterationStart(final Memory memory) {
    assertNotNull(this.haltedTraversers);
    this.haltedTraversers.clear();
    assertFalse(memory.exists(TraversalVertexProgram.HALTED_TRAVERSERS));
    MemoryTraversalSideEffects.setMemorySideEffects(this.traversal.get(), memory, ProgramPhase.WORKER_ITERATION_START);
    checkSideEffects();
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:9,代码来源:ProgramTest.java

示例5: workerIterationEnd

import org.apache.tinkerpop.gremlin.process.computer.traversal.MemoryTraversalSideEffects; //导入方法依赖的package包/类
@Override
public void workerIterationEnd(final Memory memory) {
    assertFalse(memory.exists(TraversalVertexProgram.HALTED_TRAVERSERS));
    MemoryTraversalSideEffects.setMemorySideEffects(this.traversal.get(), memory, ProgramPhase.WORKER_ITERATION_END);
    checkSideEffects();
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:7,代码来源:ProgramTest.java


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