com.tinkerpop.blueprints.impls.tg.TinkerEdge Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of blueprints-core Show documentation
Show all versions of blueprints-core Show documentation
Core interfaces and utilities for Blueprints
package com.tinkerpop.blueprints.impls.tg;
import com.tinkerpop.blueprints.Direction;
import com.tinkerpop.blueprints.Edge;
import com.tinkerpop.blueprints.Vertex;
import com.tinkerpop.blueprints.util.ExceptionFactory;
import com.tinkerpop.blueprints.util.StringFactory;
import java.io.Serializable;
/**
* @author Marko A. Rodriguez (http://markorodriguez.com)
*/
class TinkerEdge extends TinkerElement implements Edge, Serializable {
private final String label;
private final Vertex inVertex;
private final Vertex outVertex;
protected TinkerEdge(final String id, final Vertex outVertex, final Vertex inVertex, final String label, final TinkerGraph graph) {
super(id, graph);
this.label = label;
this.outVertex = outVertex;
this.inVertex = inVertex;
this.graph.edgeKeyIndex.autoUpdate(StringFactory.LABEL, this.label, null, this);
}
public String getLabel() {
return this.label;
}
public Vertex getVertex(final Direction direction) throws IllegalArgumentException {
if (direction.equals(Direction.IN))
return this.inVertex;
else if (direction.equals(Direction.OUT))
return this.outVertex;
else
throw ExceptionFactory.bothIsNotSupported();
}
public String toString() {
return StringFactory.edgeString(this);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy