/** * Creates a new property from the given arguments. Note that the given * value type must be supported by {@link PropertyValue}. * * @param key property key * @param value property value * @return property */ public static Property create(String key, Object value) { return new Property(key, PropertyValue.create(value)); }
/** * Creates a new import vertex. * * @param id import vertex id (i.e. identifier in the source system)* * @param label vertex label */ public ImportVertex(K id, String label) { this(id, label, Properties.createWithCapacity(0)); }
/** * Constructor */ CSVLineToElement() { this.properties = Properties.create(); }
@Override public PropertyValue getDefaultValue() { return PropertyValue.create(0L); } }
/** * Get the type byte of a {@link PropertyValue} instance. It's the first one of the * raw representation of a PropertyValue. * * @param value the {@link PropertyValue} to extract the type byte * @return the type byte as array */ public static byte[] getTypeByte(PropertyValue value) { byte[] typeByte = new byte[1]; typeByte[0] = value.getRawBytes()[0]; return typeByte; }
/** * Create a {@link PropertyValue} that wraps a byte array * @param rawBytes array to wrap * @return new instance of {@link PropertyValue} */ public static PropertyValue fromRawBytes(byte[] rawBytes) { return new PropertyValue(rawBytes); }
@Override public PropertyValue getPropertyValue(String key) { // TODO: return PropertyValue.NULL_VALUE instead? return (properties != null) ? properties.get(key) : null; }
@Override default PropertyValue aggregate(PropertyValue aggregate, PropertyValue increment) { return PropertyValueUtils.Numeric.max(aggregate, increment); } }
/** * Creates a new property value from the given byte array. * * @param bytes byte array */ private PropertyValue(byte[] bytes) { setBytes(bytes); }
@Override default PropertyValue aggregate(PropertyValue aggregate, PropertyValue increment) { return PropertyValueUtils.Numeric.min(aggregate, increment); } }
@Override default PropertyValue aggregate(PropertyValue aggregate, PropertyValue increment) { return PropertyValueUtils.Boolean.or(aggregate, increment); } }
/** * Compares two numerical property values and returns the bigger one. * * @param a first value * @param b second value * * @return bigger value */ public static PropertyValue max(PropertyValue a, PropertyValue b) { return isLessOrEqualThan(a, b) ? b : a; }
/** * Constructor */ CSVLineToElement() { this.properties = Properties.create(); }
@Override public PropertyValue getDefaultValue() { return PropertyValue.create(0L); } }
/** * Creates a new import edge. * * @param edgeId import edge id (i.e. identifier in source system) * @param sourceId import source vertex id * @param targetId import target vertex id * @param label edge label */ public ImportEdge(K edgeId, K sourceId, K targetId, String label) { this(edgeId, sourceId, targetId, label, Properties.createWithCapacity(0)); }
@Override default PropertyValue aggregate(PropertyValue aggregate, PropertyValue increment) { return PropertyValueUtils.Numeric.max(aggregate, increment); } }
/** * Constructor */ CSVLineToElement() { this.properties = Properties.create(); }