AIMA.Core.Logic.FOL.Unifier.unifyVar C# (CSharp) Метод

unifyVar() приватный Метод

private unifyVar ( Variable var, FOLNode x, Term>.Dictionary theta ) : Term>.Dictionary
var AIMA.Core.Logic.FOL.Parsing.AST.Variable
x FOLNode
theta Term>.Dictionary
Результат Term>.Dictionary
        private Dictionary<Variable, Term> unifyVar(Variable var, FOLNode x,
                Dictionary<Variable, Term> theta)
        {

            if (!(x is Term))
            {
                return null;
            }
            else if (theta.ContainsKey(var))
            {
                // if {var/val} E theta then return UNIFY(val, x, theta)
                return unify(theta[var], x, theta);
            }
            else if (theta.Keys.Contains(x))
            {
                // else if {x/val} E theta then return UNIFY(var, val, theta)
                return unify(var, (FOLNode)theta[(Variable)x], theta);
            }
            else if (occurCheck(theta, var, x))
            {
                // else if OCCUR-CHECK?(var, x) then return failure
                return null;
            }
            else
            {
                // else return add {var/x} to theta
                cascadeSubstitution(theta, var, (Term)x);
                return theta;
            }
        }