hydra.langs.tinkerpop.propertyGraph.Element Maven / Gradle / Ivy
package hydra.langs.tinkerpop.propertyGraph;
import java.io.Serializable;
/**
* Either a vertex or an edge
*/
public abstract class Element implements Serializable {
public static final hydra.core.Name NAME = new hydra.core.Name("hydra/langs/tinkerpop/propertyGraph.Element");
private Element () {
}
public abstract R accept(Visitor visitor) ;
public interface Visitor {
R visit(Vertex instance) ;
R visit(Edge instance) ;
}
public interface PartialVisitor extends Visitor {
default R otherwise(Element instance) {
throw new IllegalStateException("Non-exhaustive patterns when matching: " + (instance));
}
default R visit(Vertex instance) {
return otherwise((instance));
}
default R visit(Edge instance) {
return otherwise((instance));
}
}
public static final class Vertex extends hydra.langs.tinkerpop.propertyGraph.Element implements Serializable {
public final hydra.langs.tinkerpop.propertyGraph.Vertex value;
public Vertex (hydra.langs.tinkerpop.propertyGraph.Vertex value) {
this.value = value;
}
@Override
public boolean equals(Object other) {
if (!(other instanceof Vertex)) {
return false;
}
Vertex o = (Vertex) (other);
return value.equals(o.value);
}
@Override
public int hashCode() {
return 2 * value.hashCode();
}
@Override
public R accept(Visitor visitor) {
return visitor.visit(this);
}
}
public static final class Edge extends hydra.langs.tinkerpop.propertyGraph.Element implements Serializable {
public final hydra.langs.tinkerpop.propertyGraph.Edge value;
public Edge (hydra.langs.tinkerpop.propertyGraph.Edge value) {
this.value = value;
}
@Override
public boolean equals(Object other) {
if (!(other instanceof Edge)) {
return false;
}
Edge o = (Edge) (other);
return value.equals(o.value);
}
@Override
public int hashCode() {
return 2 * value.hashCode();
}
@Override
public R accept(Visitor visitor) {
return visitor.visit(this);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy