This commit is contained in:
Alexander Bachinger
2025-05-19 19:33:43 +02:00
parent 37f7dd75ff
commit 5ee8d1a359
4 changed files with 15 additions and 20 deletions

View File

@@ -1,22 +1,20 @@
package UE21_290425_Bruecke;
import java.time.LocalTime;
public class Car extends Thread {
public Long index;
public LocalTime arrivingTime;
public long arrivingTime;
public Guard guard;
public Car(Guard guard, long index) {
this.guard = guard;
this.arrivingTime = LocalTime.now();
this.arrivingTime = System.currentTimeMillis();
this.index = index;
}
@Override
public void run() {
try {
Thread.sleep(Variables.CROSSING_TIME);
Thread.sleep(Variables.CROSSING_TIME * 1000);
guard.leavingBridge();
} catch (InterruptedException e) {
throw new RuntimeException(e);