24 lines
552 B
Java
24 lines
552 B
Java
package UE21_290425_Bruecke;
|
|
|
|
public class Car extends Thread {
|
|
public Long index;
|
|
public long arrivingTime;
|
|
public Guard guard;
|
|
|
|
public Car(Guard guard, long index) {
|
|
this.guard = guard;
|
|
this.arrivingTime = System.currentTimeMillis();
|
|
this.index = index;
|
|
}
|
|
|
|
@Override
|
|
public void run() {
|
|
try {
|
|
Thread.sleep(Variables.CROSSING_TIME * 1000);
|
|
guard.leavingBridge();
|
|
} catch (InterruptedException e) {
|
|
throw new RuntimeException(e);
|
|
}
|
|
|
|
}
|
|
} |