Example #1
0
        /// <summary>
        /// In write mode, writes the value of a variable to the current structure. In read mode,
        /// unifies the value in the current structure with the value of a variable.
        /// </summary>
        private bool UnifyValue(int variable)
        {
            if (!_writeMode)
            {
                if (!_registers[variable].Unify(_structurePtr, _trail))
                {
                    return(false);
                }
            }
            else
            {
                _lastArgument.SetTo(_registers[variable]);
                _lastArgument = _lastArgument.NextArgument;
            }

            _structurePtr = _structurePtr.NextArgument;

            return(true);
        }
Example #2
0
 /// <summary>
 /// Binds one value to anoteher
 /// </summary>
 private void Bind(IReferenceLiteral target, IReferenceLiteral value)
 {
     _trail.Record(target);
     target.SetTo(value);
 }
Example #3
0
 /// <summary>
 /// Binds a value to the heap
 /// </summary>
 private void Bind(IReferenceLiteral target, IReferenceLiteral value)
 {
     target.SetTo(value);
     _trails.Peek().Record(target);
 }
Example #4
0
 /// <summary>
 /// Binds a value to the heap
 /// </summary>
 private void Bind(IReferenceLiteral target, IReferenceLiteral value)
 {
     target.SetTo(value);
     _trails.Peek().Record(target);
 }
Example #5
0
 /// <summary>
 /// Binds one value to anoteher
 /// </summary>
 private void Bind(IReferenceLiteral target, IReferenceLiteral value)
 {
     _trail.Record(target);
     target.SetTo(value);
 }