use of com.baidu.hugegraph.computer.core.graph.id.BytesId in project hugegraph-computer by hugegraph.
the class StoreTestUtil method idFromPointer.
public static Id idFromPointer(Pointer pointer) throws IOException {
BytesInput input = IOFactory.createBytesInput(pointer.bytes());
Id id = new BytesId();
id.read(input);
return id;
}
use of com.baidu.hugegraph.computer.core.graph.id.BytesId in project hugegraph-computer by hugegraph.
the class SerializeUtilTest method testConvertBytesAndListObject.
@Test
public void testConvertBytesAndListObject() {
Id id1 = BytesId.of(1L);
Id id2 = BytesId.of(2L);
List<Id> list1 = new ArrayList<>(2);
list1.add(id1);
list1.add(id2);
byte[] bytes = SerializeUtil.toBytes(list1);
List<Id> list2 = SerializeUtil.fromBytes(bytes, () -> new BytesId());
Assert.assertEquals(list1, list2);
}
use of com.baidu.hugegraph.computer.core.graph.id.BytesId in project hugegraph-computer by hugegraph.
the class IdValueTest method testEquals.
@Test
public void testEquals() {
Value value1 = new BytesId();
Assert.assertEquals(value1, value1);
Assert.assertEquals(value1, new BytesId());
Assert.assertNotEquals(value1, new BytesId(IdType.LONG, new byte[] { 1 }));
Assert.assertNotEquals(value1, new IntValue(1));
Assert.assertNotEquals(null, value1);
}
use of com.baidu.hugegraph.computer.core.graph.id.BytesId in project hugegraph-computer by hugegraph.
the class StreamGraphInput method readId.
public static Id readId(RandomAccessInput in) throws IOException {
Id id = new BytesId();
id.read(in);
return id;
}
Aggregations