hydra.ext.datalog.syntax.AtomList Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of hydra-ext Show documentation
Show all versions of hydra-ext Show documentation
Hydra language extensions in Java; models, coders, and utilities
The newest version!
// Note: this is an automatically generated file. Do not edit.
package hydra.ext.datalog.syntax;
import java.io.Serializable;
public abstract class AtomList implements Serializable {
public static final hydra.core.Name TYPE_NAME = new hydra.core.Name("hydra/ext/datalog/syntax.AtomList");
public static final hydra.core.Name FIELD_NAME_SINGLE = new hydra.core.Name("single");
public static final hydra.core.Name FIELD_NAME_MULTIPLE = new hydra.core.Name("multiple");
private AtomList () {
}
public abstract R accept(Visitor visitor) ;
public interface Visitor {
R visit(Single instance) ;
R visit(Multiple instance) ;
}
public interface PartialVisitor extends Visitor {
default R otherwise(AtomList instance) {
throw new IllegalStateException("Non-exhaustive patterns when matching: " + (instance));
}
default R visit(Single instance) {
return otherwise((instance));
}
default R visit(Multiple instance) {
return otherwise((instance));
}
}
public static final class Single extends hydra.ext.datalog.syntax.AtomList implements Serializable {
public final hydra.ext.datalog.syntax.Atom value;
public Single (hydra.ext.datalog.syntax.Atom value) {
java.util.Objects.requireNonNull((value));
this.value = value;
}
@Override
public boolean equals(Object other) {
if (!(other instanceof Single)) {
return false;
}
Single o = (Single) (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 Multiple extends hydra.ext.datalog.syntax.AtomList implements Serializable {
public final hydra.ext.datalog.syntax.AtomList_Multiple value;
public Multiple (hydra.ext.datalog.syntax.AtomList_Multiple value) {
java.util.Objects.requireNonNull((value));
this.value = value;
}
@Override
public boolean equals(Object other) {
if (!(other instanceof Multiple)) {
return false;
}
Multiple o = (Multiple) (other);
return value.equals(o.value);
}
@Override
public int hashCode() {
return 2 * value.hashCode();
}
@Override
public R accept(Visitor visitor) {
return visitor.visit(this);
}
}
}