Java Code Examples for org.apache.tinkerpop.gremlin.process.traversal.Bytecode#getStepInstructions()

The following examples show how to use org.apache.tinkerpop.gremlin.process.traversal.Bytecode#getStepInstructions() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HugeGraphAuthProxy.java    From hugegraph with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("unused")
private String translate(Bytecode bytecode) {
    // GroovyTranslator.of("g").translate(bytecode);
    List<Instruction> steps = bytecode.getStepInstructions();
    StringBuilder sb = new StringBuilder();
    sb.append("g");
    int stepsPrint = Math.min(10, steps.size());
    for (int i = 0; i < stepsPrint; i++) {
        Instruction step = steps.get(i);
        sb.append('.').append(step);
    }
    if (stepsPrint < steps.size()) {
        sb.append("..");
    }
    return sb.toString();
}
 
Example 2
Source File: ByteCodeSerializer.java    From tinkerpop with Apache License 2.0 5 votes vote down vote up
@Override
protected void writeValue(final Bytecode value, final Buffer buffer, final GraphBinaryWriter context) throws IOException {
    final List<Bytecode.Instruction> steps = value.getStepInstructions();
    final List<Bytecode.Instruction> sources = value.getSourceInstructions();
    // 2 buffers for the length + plus 2 buffers per each step and source

    writeInstructions(buffer, context, steps);
    writeInstructions(buffer, context, sources);
}