package ix.robot;
import ix.ip2.*;
import ix.util.lisp.*;
import ix.icore.domain.*;

public class TestIP2 extends Thread{

	protected Ip2 ip2;

	public TestIP2(){}
	
	public void run()
	{
		for(int p =0; p< 20; p++)
		{
			try{
				synchronized(this) { this.wait(1000);}
			}
			catch(Exception e){};
			int level = p;
		    String patternString = "battery robot";
		    LList pattern = Lisp.elementsFromString(patternString);
		    Object value = new Long(level);
		    
		    PatternAssignment pa = new PatternAssignment(pattern, value);
		    
		    Constraint c = new Constraint("world-state","effect",Lisp.list(pa));
		    
		    ip2.handleNewConstraint(c);
		}
		
	}
	
	public void setIP2(Ip2 ip2)
	{
		this.ip2 = ip2;
	}

}