hydra.graph.TermCoder Maven / Gradle / Ivy
package hydra.graph;
/**
* A type together with a coder for mapping terms into arguments for primitive functions, and mapping computed results into terms
*/
public class TermCoder {
public static final hydra.core.Name NAME = new hydra.core.Name("hydra/graph.TermCoder");
public final hydra.core.Type type;
public final hydra.compute.Coder, hydra.graph.Graph, hydra.core.Term, X> coder;
public TermCoder (hydra.core.Type type, hydra.compute.Coder, hydra.graph.Graph, hydra.core.Term, X> coder) {
this.type = type;
this.coder = coder;
}
@Override
public boolean equals(Object other) {
if (!(other instanceof TermCoder)) {
return false;
}
TermCoder o = (TermCoder) (other);
return type.equals(o.type) && coder.equals(o.coder);
}
@Override
public int hashCode() {
return 2 * type.hashCode() + 3 * coder.hashCode();
}
public TermCoder withType(hydra.core.Type type) {
return new TermCoder(type, coder);
}
public TermCoder withCoder(hydra.compute.Coder, hydra.graph.Graph, hydra.core.Term, X> coder) {
return new TermCoder(type, coder);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy