hydra.langs.tinkerpop.mappings.ElementSpec Maven / Gradle / Ivy
package hydra.langs.tinkerpop.mappings;
import java.io.Serializable;
/**
* Either a vertex specification or an edge specification
*/
public abstract class ElementSpec implements Serializable {
public static final hydra.core.Name NAME = new hydra.core.Name("hydra/langs/tinkerpop/mappings.ElementSpec");
private ElementSpec () {
}
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(ElementSpec 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.mappings.ElementSpec implements Serializable {
public final hydra.langs.tinkerpop.mappings.VertexSpec value;
public Vertex (hydra.langs.tinkerpop.mappings.VertexSpec 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.mappings.ElementSpec implements Serializable {
public final hydra.langs.tinkerpop.mappings.EdgeSpec value;
public Edge (hydra.langs.tinkerpop.mappings.EdgeSpec 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