package onewayStreet; import java.util.concurrent.Semaphore; public class Car extends Thread { static final int FROM_SENSE1= -1; static final int FROM_SENSE2 = 1; static final int VariableOverstekenTijd = 50; static final int FixedCrossTime = (int)(onewayStreet.TimeYELLOW/2) - VariableOverstekenTijd; static Semaphore sem1=new Semaphore(1);//sem1 impose order from sense1 static Semaphore sem2=new Semaphore(1);//sem2 impose order from sense2 protected int carId; protected onewayStreet o = null; public int getCarId() { return carId; } public void setCarId(int carId) { this.carId = carId; } public synchronized onewayStreet getO() { return o; } public synchronized void setO(onewayStreet o) { this.o = o; } protected int getVariableTimeToCross() { return (int)(Math.random()*VariableOverstekenTijd );} public Car( int cid, onewayStreet o) { setCarId(cid); setO(o);} public void run() { } }