Package net.hydromatic.morel.util
Interface Unifier.Term
- All Known Implementing Classes:
Unifier.Sequence,Unifier.Variable
- Enclosing class:
Unifier
public static interface Unifier.Term
Term (variable, symbol or node).
-
Method Summary
Modifier and TypeMethodDescription<R> Raccept(Unifier.TermVisitor<R> visitor) Accepts a visitor.apply(Map<Unifier.Variable, Unifier.Term> substitutions) Applies a substitution to this term.apply1(Unifier.Variable variable, Unifier.Term term) Applies a single-variable substitution to this term.voidcheckCycle(Map<Unifier.Variable, Unifier.Term> map, Map<Unifier.Variable, Unifier.Variable> active) Throws CycleException if expanding this term leads to a cycle.booleancontains(Unifier.Variable variable) Returns whether this term references a given variable.default booleancouldUnifyWith(Unifier.Term term) Returns whether this term could possibly unify with another term.
-
Method Details
-
apply
Applies a substitution to this term. -
apply1
Applies a single-variable substitution to this term. -
contains
Returns whether this term references a given variable. -
checkCycle
void checkCycle(Map<Unifier.Variable, Unifier.Term> map, Map<Unifier.Variable, throws Unifier.CycleExceptionUnifier.Variable> active) Throws CycleException if expanding this term leads to a cycle.- Throws:
Unifier.CycleException
-
accept
Accepts a visitor. -
couldUnifyWith
Returns whether this term could possibly unify with another term.Returns true if
thisortermis a variable, or if they are sequences with the same operator and number of terms, and if all pairs of those terms could unify.
-