removeAssignment() public method

public removeAssignment ( Variable var ) : void
var Variable
return void
 /**
  * Template method, which can be configured by overriding the three
  * primitive operations below.
  */
 private Assignment recursiveBackTrackingSearch(CSP csp,
         Assignment assignment)
 {
     Assignment result = null;
     if (assignment.isComplete(csp.getVariables()))
     {
         result = assignment;
     }
     else
     {
         Variable var = selectUnassignedVariable(assignment, csp);
         foreach (Object value in orderDomainValues(var, assignment, csp))
         {
             assignment.setAssignment(var, value);
             fireStateChanged(assignment, csp);
             if (assignment.isConsistent(csp.getConstraints(var)))
             {
                 DomainRestoreInfo info = inference(var, assignment, csp);
                 if (!info.isEmpty())
                     fireStateChanged(csp);
                 if (!info.isEmptyDomainFound())
                 {
                     result = recursiveBackTrackingSearch(csp, assignment);
                     if (result != null)
                         break;
                 }
                 info.restoreDomains(csp);
             }
             assignment.removeAssignment(var);
         }
     }
     return result;
 }
        private bool revise(Variable var, Constraint constraint,
                            Assignment assignment, CSP csp, DomainRestoreInfo info)
        {
            bool revised = false;

            foreach (Object value in csp.getDomain(var))
            {
                assignment.setAssignment(var, value);
                if (!constraint.isSatisfiedWith(assignment))
                {
                    info.storeDomainFor(var, csp.getDomain(var));
                    csp.removeValueFromDomain(var, value);
                    revised = true;
                }
                assignment.removeAssignment(var);
            }
            return(revised);
        }
        /**
         * Template method, which can be configured by overriding the three
         * primitive operations below.
         */
        private Assignment recursiveBackTrackingSearch(CSP csp,
                                                       Assignment assignment)
        {
            Assignment result = null;

            if (assignment.isComplete(csp.getVariables()))
            {
                result = assignment;
            }
            else
            {
                Variable var = selectUnassignedVariable(assignment, csp);
                foreach (Object value in orderDomainValues(var, assignment, csp))
                {
                    assignment.setAssignment(var, value);
                    fireStateChanged(assignment, csp);
                    if (assignment.isConsistent(csp.getConstraints(var)))
                    {
                        DomainRestoreInfo info = inference(var, assignment, csp);
                        if (!info.isEmpty())
                        {
                            fireStateChanged(csp);
                        }
                        if (!info.isEmptyDomainFound())
                        {
                            result = recursiveBackTrackingSearch(csp, assignment);
                            if (result != null)
                            {
                                break;
                            }
                        }
                        info.restoreDomains(csp);
                    }
                    assignment.removeAssignment(var);
                }
            }
            return(result);
        }
        private bool revise(Variable var, Constraint constraint,
                Assignment assignment, CSP csp, DomainRestoreInfo info)
        {

            bool revised = false;
            foreach (Object value in csp.getDomain(var))
            {
                assignment.setAssignment(var, value);
                if (!constraint.isSatisfiedWith(assignment))
                {
                    info.storeDomainFor(var, csp.getDomain(var));
                    csp.removeValueFromDomain(var, value);
                    revised = true;
                }
                assignment.removeAssignment(var);
            }
            return revised;
        }