Package net.hydromatic.morel.util
Class Unifier.Sequence
java.lang.Object
net.hydromatic.morel.util.Unifier.Sequence
- All Implemented Interfaces:
Unifier.Term
- Enclosing class:
Unifier
A sequence of terms.
A sequence [a b c] is often printed "a(b, c)", as if "a" is the type of node and "b" and "c" are its children.
-
Field Summary
Fields -
Constructor Summary
Constructors -
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.booleancouldUnifyWith(Unifier.Term term) Returns whether this term could possibly unify with another term.booleaninthashCode()private static <E> booleantoString()
-
Field Details
-
operator
-
terms
-
-
Constructor Details
-
Sequence
Sequence(String operator, List<Unifier.Term> terms) -
Sequence
Sequence(String operator)
-
-
Method Details
-
hashCode
public int hashCode() -
equals
-
couldUnifyWith
Description copied from interface:Unifier.TermReturns 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.- Specified by:
couldUnifyWithin interfaceUnifier.Term
-
toString
-
apply
Description copied from interface:Unifier.TermApplies a substitution to this term.- Specified by:
applyin interfaceUnifier.Term
-
apply1
Description copied from interface:Unifier.TermApplies a single-variable substitution to this term.- Specified by:
apply1in interfaceUnifier.Term
-
checkCycle
public void checkCycle(Map<Unifier.Variable, Unifier.Term> map, Map<Unifier.Variable, throws Unifier.CycleExceptionUnifier.Variable> active) Description copied from interface:Unifier.TermThrows CycleException if expanding this term leads to a cycle.- Specified by:
checkCyclein interfaceUnifier.Term- Throws:
Unifier.CycleException
-
listEqual
-
contains
Description copied from interface:Unifier.TermReturns whether this term references a given variable.- Specified by:
containsin interfaceUnifier.Term
-
accept
Description copied from interface:Unifier.TermAccepts a visitor.- Specified by:
acceptin interfaceUnifier.Term
-