![JAR search and dependency download from the Maven repository](/logo.png)
com.tinkerpop.gremlin.tinkergraph.structure.TinkerVertex Maven / Gradle / Ivy
package com.tinkerpop.gremlin.tinkergraph.structure;
import com.tinkerpop.gremlin.process.graph.GraphTraversal;
import com.tinkerpop.gremlin.structure.Direction;
import com.tinkerpop.gremlin.structure.Edge;
import com.tinkerpop.gremlin.structure.Property;
import com.tinkerpop.gremlin.structure.Vertex;
import com.tinkerpop.gremlin.structure.VertexProperty;
import com.tinkerpop.gremlin.structure.util.ElementHelper;
import com.tinkerpop.gremlin.structure.util.StringFactory;
import com.tinkerpop.gremlin.tinkergraph.process.graph.TinkerElementTraversal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
/**
* @author Marko A. Rodriguez (http://markorodriguez.com)
*/
public class TinkerVertex extends TinkerElement implements Vertex, Vertex.Iterators {
protected Map> outEdges = new HashMap<>();
protected Map> inEdges = new HashMap<>();
private static final Object[] EMPTY_ARGS = new Object[0];
protected TinkerVertex(final Object id, final String label, final TinkerGraph graph) {
super(id, label, graph);
}
@Override
public VertexProperty property(final String key) {
if (TinkerHelper.inComputerMode(this.graph)) {
final List list = (List) this.graph.graphView.getProperty(this, key);
if (list.size() == 0)
return VertexProperty.empty();
else if (list.size() == 1)
return list.get(0);
else
throw Vertex.Exceptions.multiplePropertiesExistForProvidedKey(key);
} else {
if (this.properties.containsKey(key)) {
final List list = (List) this.properties.get(key);
if (list.size() > 1)
throw Vertex.Exceptions.multiplePropertiesExistForProvidedKey(key);
else
return list.get(0);
} else
return VertexProperty.empty();
}
}
@Override
public VertexProperty property(final String key, final V value) {
return this.property(key, value, EMPTY_ARGS);
}
@Override
public VertexProperty property(final String key, final V value, final Object... keyValues) {
ElementHelper.legalPropertyKeyValueArray(keyValues);
final Optional
© 2015 - 2025 Weber Informatics LLC | Privacy Policy