Search in sources :

Example 6 with InlinePointer

use of com.baidu.hugegraph.computer.core.store.entry.InlinePointer in project hugegraph-computer by hugegraph.

the class AbstractPointerCombiner method combine.

public Pointer combine(Pointer v1, Pointer v2) {
    try {
        RandomAccessInput input1 = v1.input();
        RandomAccessInput input2 = v2.input();
        input1.seek(v1.offset());
        input2.seek(v2.offset());
        this.v1.read(input1);
        this.v2.read(input2);
        this.combiner.combine(this.v1, this.v2, this.result);
        this.output.seek(0L);
        this.result.write(this.output);
        return new InlinePointer(this.output.buffer(), this.output.position());
    } catch (Exception e) {
        throw new ComputerException("Failed to combine pointer1(offset=%s, length=%s) and " + "pointer2(offset=%s, length=%s)'", e, v1.offset(), v1.length(), v2.offset(), v2.length());
    }
}
Also used : RandomAccessInput(com.baidu.hugegraph.computer.core.io.RandomAccessInput) InlinePointer(com.baidu.hugegraph.computer.core.store.entry.InlinePointer) ComputerException(com.baidu.hugegraph.computer.core.common.exception.ComputerException) ComputerException(com.baidu.hugegraph.computer.core.common.exception.ComputerException)

Aggregations

InlinePointer (com.baidu.hugegraph.computer.core.store.entry.InlinePointer)6 Config (com.baidu.hugegraph.computer.core.config.Config)4 BytesOutput (com.baidu.hugegraph.computer.core.io.BytesOutput)4 Pointer (com.baidu.hugegraph.computer.core.store.entry.Pointer)4 Test (org.junit.Test)4 BytesInput (com.baidu.hugegraph.computer.core.io.BytesInput)3 RandomAccessInput (com.baidu.hugegraph.computer.core.io.RandomAccessInput)3 ComputerException (com.baidu.hugegraph.computer.core.common.exception.ComputerException)2 GraphFactory (com.baidu.hugegraph.computer.core.graph.GraphFactory)2 Properties (com.baidu.hugegraph.computer.core.graph.properties.Properties)2 DoubleValue (com.baidu.hugegraph.computer.core.graph.value.DoubleValue)2 LongValue (com.baidu.hugegraph.computer.core.graph.value.LongValue)2 IntValueSumCombiner (com.baidu.hugegraph.computer.core.combiner.IntValueSumCombiner)1 PointerCombiner (com.baidu.hugegraph.computer.core.combiner.PointerCombiner)1 Constants (com.baidu.hugegraph.computer.core.common.Constants)1 ComputerOptions (com.baidu.hugegraph.computer.core.config.ComputerOptions)1 IntValue (com.baidu.hugegraph.computer.core.graph.value.IntValue)1 Value (com.baidu.hugegraph.computer.core.graph.value.Value)1 IOFactory (com.baidu.hugegraph.computer.core.io.IOFactory)1 Sorter (com.baidu.hugegraph.computer.core.sort.Sorter)1