package edu.unl.consystlab.sudokuSolver;
import java.util.LinkedList;
import java.util.List;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;

public class nonBinarySearch extends search {

	public nonBinarySearch(constraintProblem newProblem)
	{
		super(newProblem);
	}
	
//	public void nonBinaryMAC()
//	{
//		
//		//1.Put all of the constraints into a set to avoid duplicates
//		//2. Run MAC on the first one.
//		//3. Take the list of reductions and add back other constraints connected
//		// to those variables
//		//4. keep looping to 1.
//		
//		Set myConstraintList;// = new HashSet();
//		//1.Put all of the constraints into a set to avoid duplicates
//		myConstraintList = new HashSet(super.problem.getAllNonBinaryIntensiveConstraints());
//
//		while(!myConstraintList.isEmpty())
//		{
//			//don't remove it now so that it doesn't get added back.
//			nonBinaryIntensiveConstraint topConstraint = (nonBinaryIntensiveConstraint)(myConstraintList.iterator().next());
//			
//			//2. Run MAC on the first one.
//			List removedValueVariablePairs = topConstraint.updateGraph();
//			
//			//if removedValueVariablePairs is null there was an error
//			if(removedValueVariablePairs == null)
//			{
//				return;
//			}
//			
//			//3. Take the list of reductions and add back other constraints connected
//			while(!removedValueVariablePairs.isEmpty())
//			{
//				List topVariableValuePair = (LinkedList)removedValueVariablePairs.get(0);
//				removedValueVariablePairs.remove(0);
//				
//				if( ((graphNode)topVariableValuePair.get(0)).isVariable() )
//				{
//					//add back constraints
//					List changedConstraints = (((problemVariable)((graphNode)topVariableValuePair.get(0)).getVariable()).getNonBinaryIntensiveConstraints());
//					Iterator i = changedConstraints.iterator();
//					while(i.hasNext())
//					{
//						myConstraintList.add(i.next());
//					}
//				}
//				else
//				{
//					//add back constraints
//					List changedConstraints = (((problemVariable)((graphNode)topVariableValuePair.get(1)).getVariable()).getNonBinaryIntensiveConstraints());
//					Iterator i = changedConstraints.iterator();
//					while(i.hasNext())
//					{
//						myConstraintList.add(i.next());
//					}
//				}
//			}
//			
//			//now remove it
//			myConstraintList.remove(topConstraint);
//			
//		}
//	}
}
