@Override public Set<String> keys() { return this.element.keys().stream().filter(key -> !computeKeys.contains(key)).collect(Collectors.toSet()); }
/** * Retrieve the properties associated with a particular element. * The result is a Object[] where odd indices are String keys and even indices are the values. * * @param element the element to retrieve properties from * @param includeId include Element.ID in the key/value list * @param includeLabel include Element.LABEL in the key/value list * @param propertiesToCopy the properties to include with an empty list meaning copy all properties * @return a key/value array of properties where odd indices are String keys and even indices are the values. */ public static Object[] getProperties(final Element element, final boolean includeId, final boolean includeLabel, final Set<String> propertiesToCopy) { final List<Object> keyValues = new ArrayList<>(); if (includeId) { keyValues.add(T.id); keyValues.add(element.id()); } if (includeLabel) { keyValues.add(T.label); keyValues.add(element.label()); } element.keys().forEach(key -> { if (propertiesToCopy.isEmpty() || propertiesToCopy.contains(key)) { keyValues.add(key); keyValues.add(element.value(key)); } }); return keyValues.toArray(new Object[keyValues.size()]); }
@Override public Set<String> keys() { return this.element.keys().stream().filter(key -> !computeKeys.contains(key)).collect(Collectors.toSet()); }
private Set<String> getKeys(Element element, Set<String> propertiesToIgnore) { return element.keys().stream().filter(key -> !propertiesToIgnore.contains(key)).collect(Collectors.toSet()); }
public static void mergeProperties(final Element element, final Element storeElement, final Element ancestorElement, final PropertyConflictResolutionStrategy strategy) { checkNotNull(element, "Precondition violation - argument 'element' must not be NULL!"); checkNotNull(storeElement, "Precondition violation - argument 'storeElement' must not be NULL!"); checkNotNull(strategy, "Precondition violation - argument 'strategy' must not be NULL!"); // get all element property keys Set<String> elementKeys = Sets.newHashSet(element.keys()); Set<String> storeElementKeys = Sets.newHashSet(storeElement.keys()); Set<String> allKeys = Sets.union(elementKeys, storeElementKeys); for (String propertyKey : allKeys) { mergeSingleProperty(propertyKey, element, storeElement, ancestorElement, strategy); } }
@Override public Set<String> getPropertyKeys() { return getElement().keys(); }
@Override public Set<String> getPropertyKeys() { return getWrappedElement().keys(); }
@Override public Set<String> getPropertyKeys() { return getElement().keys(); }
@Override public Set<String> getPropertyKeys() { return getWrappedElement().keys(); }
/** * A string representation of this vertex, showing it's properties in a JSON-like format. */ default String toPrettyString() { Element v = getElement(); StringBuilder result = new StringBuilder(); result.append("[").append(v.toString()).append("="); result.append("{"); boolean hasSome = false; for (String propKey : v.keys()) { hasSome = true; Iterator<? extends Property<Object>> propVal = v.properties(propKey); List<Object> propValues = new ArrayList<>(); propVal.forEachRemaining(prop -> propValues.add(prop.value())); if (propValues.size() == 1) result.append(propKey).append(": ").append(propValues.get(0)); else result.append(propKey).append(": ").append(propValues); result.append(", "); } if (hasSome) { result.delete(result.length() - 2, result.length()); } result.append("}]"); return result.toString(); }
/** * A string representation of this vertex, showing it's properties in a JSON-like format. */ default String toPrettyString() { Element v = getElement(); StringBuilder result = new StringBuilder(); result.append("[").append(v.toString()).append("="); result.append("{"); boolean hasSome = false; for (String propKey : v.keys()) { hasSome = true; Iterator<? extends Property<Object>> propVal = v.properties(propKey); List<Object> propValues = new ArrayList<>(); propVal.forEachRemaining(prop -> propValues.add(prop.value())); if (propValues.size() == 1) result.append(propKey).append(": ").append(propValues.get(0)); else result.append(propKey).append(": ").append(propValues); result.append(", "); } if (hasSome) { result.delete(result.length() - 2, result.length()); } result.append("}]"); return result.toString(); }
/** * Retrieve the properties associated with a particular element. * The result is a Object[] where odd indices are String keys and even indices are the values. * * @param element the element to retrieve properties from * @param includeId include Element.ID in the key/value list * @param includeLabel include Element.LABEL in the key/value list * @param propertiesToCopy the properties to include with an empty list meaning copy all properties * @return a key/value array of properties where odd indices are String keys and even indices are the values. */ public static Object[] getProperties(final Element element, final boolean includeId, final boolean includeLabel, final Set<String> propertiesToCopy) { final List<Object> keyValues = new ArrayList<>(); if (includeId) { keyValues.add(T.id); keyValues.add(element.id()); } if (includeLabel) { keyValues.add(T.label); keyValues.add(element.label()); } element.keys().forEach(key -> { if (propertiesToCopy.isEmpty() || propertiesToCopy.contains(key)) { keyValues.add(key); keyValues.add(element.value(key)); } }); return keyValues.toArray(new Object[keyValues.size()]); }