@Override public Edge addEdge(final String label, final Vertex vertex, final Object... keyValues) { if (null == vertex) throw Graph.Exceptions.argumentCanNotBeNull("vertex"); if (this.removed) throw elementAlreadyRemoved(Vertex.class, this.id); return TinkerHelper.addEdge(this.graph, this, (TinkerVertex) vertex, label, keyValues); }
@Override public <V> VertexProperty<V> property(final VertexProperty.Cardinality cardinality, final String key, final V value, final Object... keyValues) { if (this.removed) throw elementAlreadyRemoved(Vertex.class, id); ElementHelper.legalPropertyKeyValueArray(keyValues); ElementHelper.validateProperty(key, value); final Optional<Object> optionalId = ElementHelper.getIdValue(keyValues); final Optional<VertexProperty<V>> optionalVertexProperty = ElementHelper.stageVertexProperty(this, cardinality, key, value, keyValues); if (optionalVertexProperty.isPresent()) return optionalVertexProperty.get(); if (TinkerHelper.inComputerMode(this.graph)) { final VertexProperty<V> vertexProperty = (VertexProperty<V>) this.graph.graphComputerView.addProperty(this, key, value); ElementHelper.attachProperties(vertexProperty, keyValues); return vertexProperty; } else { final Object idValue = optionalId.isPresent() ? graph.vertexPropertyIdManager.convert(optionalId.get()) : graph.vertexPropertyIdManager.getNextId(graph); final VertexProperty<V> vertexProperty = new TinkerVertexProperty<V>(idValue, this, key, value); if (null == this.properties) this.properties = new HashMap<>(); final List<VertexProperty> list = this.properties.getOrDefault(key, new ArrayList<>()); list.add(vertexProperty); this.properties.put(key, list); TinkerHelper.autoUpdateIndex(this, key, value, null); ElementHelper.attachProperties(vertexProperty, keyValues); return vertexProperty; } }
@Override public Edge addEdge(final String label, final Vertex vertex, final Object... keyValues) { if (null == vertex) throw Graph.Exceptions.argumentCanNotBeNull("vertex"); if (this.removed) throw elementAlreadyRemoved(Vertex.class, this.id); return TinkerHelper.addEdge(this.graph, this, (TinkerVertex) vertex, label, keyValues); }
@Override public Edge addEdge(final String label, final Vertex vertex, final Object... keyValues) { if (null == vertex) throw Graph.Exceptions.argumentCanNotBeNull("vertex"); if (this.removed) throw elementAlreadyRemoved(Vertex.class, this.id); return TinkerHelper.addEdge(this.graph, this, (TinkerVertex) vertex, label, keyValues); }
@Override public <V> VertexProperty<V> property(final VertexProperty.Cardinality cardinality, final String key, final V value, final Object... keyValues) { if (this.removed) throw elementAlreadyRemoved(Vertex.class, id); ElementHelper.legalPropertyKeyValueArray(keyValues); ElementHelper.validateProperty(key, value); final Optional<Object> optionalId = ElementHelper.getIdValue(keyValues); final Optional<VertexProperty<V>> optionalVertexProperty = ElementHelper.stageVertexProperty(this, cardinality, key, value, keyValues); if (optionalVertexProperty.isPresent()) return optionalVertexProperty.get(); if (TinkerHelper.inComputerMode(this.graph)) { final VertexProperty<V> vertexProperty = (VertexProperty<V>) this.graph.graphComputerView.addProperty(this, key, value); ElementHelper.attachProperties(vertexProperty, keyValues); return vertexProperty; } else { final Object idValue = optionalId.isPresent() ? graph.vertexPropertyIdManager.convert(optionalId.get()) : graph.vertexPropertyIdManager.getNextId(graph); final VertexProperty<V> vertexProperty = new TinkerVertexProperty<V>(idValue, this, key, value); if (null == this.properties) this.properties = new HashMap<>(); final List<VertexProperty> list = this.properties.getOrDefault(key, new ArrayList<>()); list.add(vertexProperty); this.properties.put(key, list); TinkerHelper.autoUpdateIndex(this, key, value, null); ElementHelper.attachProperties(vertexProperty, keyValues); return vertexProperty; } }
@Override public <V> VertexProperty<V> property(final VertexProperty.Cardinality cardinality, final String key, final V value, final Object... keyValues) { if (this.removed) throw elementAlreadyRemoved(Vertex.class, id); ElementHelper.legalPropertyKeyValueArray(keyValues); ElementHelper.validateProperty(key, value); final Optional<Object> optionalId = ElementHelper.getIdValue(keyValues); final Optional<VertexProperty<V>> optionalVertexProperty = ElementHelper.stageVertexProperty(this, cardinality, key, value, keyValues); if (optionalVertexProperty.isPresent()) return optionalVertexProperty.get(); if (TinkerHelper.inComputerMode(this.graph)) { final VertexProperty<V> vertexProperty = (VertexProperty<V>) this.graph.graphComputerView.addProperty(this, key, value); ElementHelper.attachProperties(vertexProperty, keyValues); return vertexProperty; } else { final Object idValue = optionalId.isPresent() ? graph.vertexPropertyIdManager.convert(optionalId.get()) : graph.vertexPropertyIdManager.getNextId(graph); final VertexProperty<V> vertexProperty = new TinkerVertexProperty<V>(idValue, this, key, value); if (null == this.properties) this.properties = new HashMap<>(); final List<VertexProperty> list = this.properties.getOrDefault(key, new ArrayList<>()); list.add(vertexProperty); this.properties.put(key, list); TinkerHelper.autoUpdateIndex(this, key, value, null); ElementHelper.attachProperties(vertexProperty, keyValues); return vertexProperty; } }