//Prototype implementation of Car Test class //Mandatory assignment 1 //Course 02152 Concurrent Systems, DTU, Fall 2008 //Hans Henrik Løvengreen Sep 24, 2008 public class CarTest extends Thread { CarTestingI cars; int testno; public CarTest(CarTestingI ct, int no) { cars = ct; testno = no; } public void run() { try { switch (testno) { case 0: // Demonstration of startAll/stopAll. // Should let the cars go one round (unless very fast) cars.startAll(); sleep(3000); cars.stopAll(); break; case 19: // Demonstration of speed setting. // Change speed to double of default values cars.println("Doubling speeds"); for (int i = 1; i < 9; i++) { cars.setSpeed(i,50); }; break; default: cars.println("Test " + testno + " not available"); } cars.println("Test ended"); } catch (Exception e) { System.err.println("Exception in test: "+e); } } }