示例#1
0
        public Frame(Goal [] goals, Goal parent, BoundVariableSet boundVariables, Dictionary <string, Variable> variables)
        {
            this.goals          = goals;
            this.boundVariables = boundVariables;
            this.HeadGoal       = parent;

            this.variables = new Variables(variables);

            foreach (var goal in goals)
            {
                goal.Frame = this;
            }
        }
示例#2
0
        Frame Unify(Compiled.Clause clause)
        {
            var boundVariables       = new BoundVariableSet();
            var argumentInstantiator = new ArgumentInstantiator();

            var clauseHeadArguments = clause.Head.Arguments.Select(a => a.Accept(argumentInstantiator)).ToArray();

            if (boundVariables.ZipUnify(Arguments, clauseHeadArguments))
            {
                Goal [] goals = EngineInternals.InstantiateGoals(clause.Body, argumentInstantiator);

                return(new Frame(goals, this, boundVariables, argumentInstantiator.Variables));
            }

            return(null);
        }
示例#3
0
 public void ReleaseVariables()
 {
     boundVariables.Release();
     boundVariables = null; // to prevent ReleaseVariables from being called twice.
 }
示例#4
0
 public ValueUnifier(IValue rhsValue, BoundVariableSet boundVariables)
 {
     this.boundVariables = boundVariables;
     this.rhsValue       = rhsValue;
 }
示例#5
0
 public LhsConcreteValueUnifier(IConcreteValue lhsConcreteValue, BoundVariableSet boundVariables)
 {
     this.lhsConcreteValue = lhsConcreteValue;
     this.boundVariables   = boundVariables;
 }