use of com.baidu.hugegraph.computer.core.graph.value.Value in project hugegraph-computer by hugegraph.
the class DefaultProperties method write.
@Override
public void write(RandomAccessOutput out) throws IOException {
out.writeInt(this.keyValues.size());
for (Map.Entry<String, Value> entry : this.keyValues.entrySet()) {
out.writeUTF(entry.getKey());
Value value = entry.getValue();
out.writeByte(value.valueType().code());
value.write(out);
}
}
use of com.baidu.hugegraph.computer.core.graph.value.Value in project hugegraph-computer by hugegraph.
the class StructGraphOutput method writeListValue.
private void writeListValue(ListValue<?> values) throws IOException {
this.writeArrayStart();
int size = values.size();
int i = 0;
for (Value value : values.values()) {
this.writeValue(value);
if (++i < size) {
this.writeSplitter();
}
}
this.writeArrayEnd();
}
use of com.baidu.hugegraph.computer.core.graph.value.Value in project hugegraph-computer by hugegraph.
the class StreamGraphInput method readValue.
@Override
public Value readValue(RandomAccessInput in) throws IOException {
byte code = in.readByte();
Value value = this.graphFactory.createValue(code);
value.read(in);
return value;
}
use of com.baidu.hugegraph.computer.core.graph.value.Value in project hugegraph-computer by hugegraph.
the class StreamGraphInput method readMessage.
private Value readMessage(RandomAccessInput in) throws IOException {
Value value = this.config.createObject(ComputerOptions.ALGORITHM_MESSAGE_CLASS);
value.read(in);
return value;
}
use of com.baidu.hugegraph.computer.core.graph.value.Value in project hugegraph-computer by hugegraph.
the class DefaultPropertiesTest method testConstructor.
@Test
public void testConstructor() {
DefaultProperties properties = new DefaultProperties(graphFactory());
Assert.assertEquals(0, properties.get().size());
properties.put("p1", new LongValue(1L));
properties.put("p2", new DoubleValue(2.0D));
Map<String, Value> props = properties.get();
Assert.assertEquals(2, props.size());
Assert.assertEquals(new LongValue(1L), props.get("p1"));
Assert.assertEquals(new DoubleValue(2.0D), props.get("p2"));
}
Aggregations