use of com.baidu.hugegraph.computer.core.graph.id.Id in project hugegraph-computer by hugegraph.
the class IdSet method read.
@Override
public void read(RandomAccessInput in) throws IOException {
int size = in.readInt();
if (size > this.values.size() || size < this.values.size() / 2) {
this.values = this.graphFactory.createSet(size);
} else {
this.values.clear();
}
for (int i = 0; i < size; i++) {
Id id = this.graphFactory.createId();
id.read(in);
this.values.add(id);
}
}
use of com.baidu.hugegraph.computer.core.graph.id.Id in project hugegraph-computer by hugegraph.
the class ComputeMessageRecvPartitionTest method addTwentyDuplicateIdValueListMessageBuffer.
private static void addTwentyDuplicateIdValueListMessageBuffer(Consumer<ManagedBuffer> consumer) throws IOException {
for (long i = 0L; i < 10L; i++) {
for (int j = 0; j < 2; j++) {
Id id = BytesId.of(i);
IdList message = new IdList();
message.add(id);
ReceiverUtil.consumeBuffer(ReceiverUtil.writeMessage(id, message), consumer);
}
}
}
use of com.baidu.hugegraph.computer.core.graph.id.Id in project hugegraph-computer by hugegraph.
the class MessageInputTest method addMessages.
private static void addMessages(Consumer<ManagedBuffer> consumer) throws IOException {
Random random = new Random(1);
for (long i = 0L; i < 200L; i++) {
int count = random.nextInt(5);
for (int j = 0; j < count; j++) {
Id id = BytesId.of(random.nextInt(200));
IdList message = new IdList();
message.add(id);
ReceiverUtil.consumeBuffer(ReceiverUtil.writeMessage(id, message), consumer);
}
}
}
use of com.baidu.hugegraph.computer.core.graph.id.Id in project hugegraph-computer by hugegraph.
the class ComputeMessageRecvPartitionTest method addTwentyCombineMessageBuffer.
public static void addTwentyCombineMessageBuffer(Consumer<ManagedBuffer> consumer) throws IOException {
for (long i = 0L; i < 10L; i++) {
for (int j = 0; j < 2; j++) {
Id id = BytesId.of(i);
DoubleValue message = new DoubleValue(i);
ReceiverUtil.consumeBuffer(ReceiverUtil.writeMessage(id, message), consumer);
}
}
}
Aggregations