alles Funktioniert

This commit is contained in:
2025-05-13 12:10:01 +02:00
parent 14c5ef09f5
commit ac3690ea14
4 changed files with 45 additions and 42 deletions

View File

@@ -3,19 +3,20 @@ package UE21_290425_Bruecke;
import java.time.LocalTime;
public class Car extends Thread {
private static final int crossingTime = 50_000;
LocalTime arrivingTime;
Guard guard;
public Long index;
public LocalTime arrivingTime;
public Guard guard;
public Car(Guard guard) {
public Car(Guard guard, long index) {
this.guard = guard;
this.arrivingTime = LocalTime.now();
this.index = index;
}
@Override
public void run() {
try {
Thread.sleep(crossingTime);
Thread.sleep(Variables.CROSSING_TIME);
guard.leaving();
} catch (InterruptedException e) {
throw new RuntimeException(e);