public void run() { while (more) { // System.out.println("call V"); MyArbitrator.objects = Launcher.findObjects(); // System.out.println(" Arbit ball "+ // MyArbitrator.objects[2].getCentre().x+","+MyArbitrator.objects[2].getCentre().y); // System.out.println("ball " + MyArbitrator.objects[2].getCentre().x); visCall++; // System.out.println("Vision Called" + visCall); // System.out.println(" mon while" + monitorw); // ObjectItem[] objects = Launcher.findObjects(); // System.out.println("call V"); // FIND HIGHEST PRIORITY behaviour THAT WANTS CONTROL synchronized (this) { _highestPriority = NONE; for (int i = maxPriority; i >= 0; i--) { if (MyArbitrator._behaviour[i].takeControl(MyArbitrator.objects)) { _highestPriority = i; break; } } int active = _active; // local copy: avoid out of bounds error in 134 if (active != NONE && _highestPriority > active) { MyArbitrator._behaviour[active].suppress(); } } // end synchronize block - main thread can run now Thread.yield(); } }