diff --git a/.gradle/7.1/executionHistory/executionHistory.bin b/.gradle/7.1/executionHistory/executionHistory.bin index d0e61a7..075f977 100644 Binary files a/.gradle/7.1/executionHistory/executionHistory.bin and b/.gradle/7.1/executionHistory/executionHistory.bin differ diff --git a/.gradle/7.1/executionHistory/executionHistory.lock b/.gradle/7.1/executionHistory/executionHistory.lock index f2762d2..8d906a3 100644 Binary files a/.gradle/7.1/executionHistory/executionHistory.lock and b/.gradle/7.1/executionHistory/executionHistory.lock differ diff --git a/.gradle/7.1/fileHashes/fileHashes.bin b/.gradle/7.1/fileHashes/fileHashes.bin index e7f6d71..8b6fcd9 100644 Binary files a/.gradle/7.1/fileHashes/fileHashes.bin and b/.gradle/7.1/fileHashes/fileHashes.bin differ diff --git a/.gradle/7.1/fileHashes/fileHashes.lock b/.gradle/7.1/fileHashes/fileHashes.lock index 34a3eba..272f2e1 100644 Binary files a/.gradle/7.1/fileHashes/fileHashes.lock and b/.gradle/7.1/fileHashes/fileHashes.lock differ diff --git a/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/.gradle/buildOutputCleanup/buildOutputCleanup.lock index 539e336..51928ac 100644 Binary files a/.gradle/buildOutputCleanup/buildOutputCleanup.lock and b/.gradle/buildOutputCleanup/buildOutputCleanup.lock differ diff --git a/build/classes/java/main/com/example/DeliveryCar$ContinueRoute.class b/build/classes/java/main/com/example/DeliveryCar$ContinueRoute.class deleted file mode 100644 index 15ce59d..0000000 Binary files a/build/classes/java/main/com/example/DeliveryCar$ContinueRoute.class and /dev/null differ diff --git a/build/classes/java/main/com/example/DeliveryCar$LoadMessage.class b/build/classes/java/main/com/example/DeliveryCar$LoadMessage.class index 5e28261..1987861 100644 Binary files a/build/classes/java/main/com/example/DeliveryCar$LoadMessage.class and b/build/classes/java/main/com/example/DeliveryCar$LoadMessage.class differ diff --git a/build/classes/java/main/com/example/DeliveryCar$PickupResponse.class b/build/classes/java/main/com/example/DeliveryCar$PickupResponse.class index b71ef40..6a5bf7c 100644 Binary files a/build/classes/java/main/com/example/DeliveryCar$PickupResponse.class and b/build/classes/java/main/com/example/DeliveryCar$PickupResponse.class differ diff --git a/build/classes/java/main/com/example/DeliveryCar.class b/build/classes/java/main/com/example/DeliveryCar.class index bc73303..2f80b47 100644 Binary files a/build/classes/java/main/com/example/DeliveryCar.class and b/build/classes/java/main/com/example/DeliveryCar.class differ diff --git a/build/classes/java/main/com/example/DistributionCenter$ArriveMessage.class b/build/classes/java/main/com/example/DistributionCenter$ArriveMessage.class index 24f9bd0..0083120 100644 Binary files a/build/classes/java/main/com/example/DistributionCenter$ArriveMessage.class and b/build/classes/java/main/com/example/DistributionCenter$ArriveMessage.class differ diff --git a/build/classes/java/main/com/example/DistributionCenter$GenerateRoutes.class b/build/classes/java/main/com/example/DistributionCenter$GenerateRoutes.class index c44a021..2740fae 100644 Binary files a/build/classes/java/main/com/example/DistributionCenter$GenerateRoutes.class and b/build/classes/java/main/com/example/DistributionCenter$GenerateRoutes.class differ diff --git a/build/classes/java/main/com/example/DistributionCenter$LoadMessage.class b/build/classes/java/main/com/example/DistributionCenter$LoadMessage.class index 1aa5557..0527f4b 100644 Binary files a/build/classes/java/main/com/example/DistributionCenter$LoadMessage.class and b/build/classes/java/main/com/example/DistributionCenter$LoadMessage.class differ diff --git a/build/classes/java/main/com/example/DistributionCenter.class b/build/classes/java/main/com/example/DistributionCenter.class index b81c67a..fbdba7e 100644 Binary files a/build/classes/java/main/com/example/DistributionCenter.class and b/build/classes/java/main/com/example/DistributionCenter.class differ diff --git a/build/tmp/compileJava/previous-compilation-data.bin b/build/tmp/compileJava/previous-compilation-data.bin index 836882c..f3fd877 100644 Binary files a/build/tmp/compileJava/previous-compilation-data.bin and b/build/tmp/compileJava/previous-compilation-data.bin differ diff --git a/src/main/java/com/example/DeliveryCar.java b/src/main/java/com/example/DeliveryCar.java index 0f9509b..4d6d0f2 100644 --- a/src/main/java/com/example/DeliveryCar.java +++ b/src/main/java/com/example/DeliveryCar.java @@ -25,9 +25,7 @@ public class DeliveryCar extends AbstractBehavior { public record PickupResponse(Paket paket) implements Message {} public record StartRoute() implements Message {} - - public record RestartRoute() implements Message{} - + private DeliveryCar(ActorContext context, ArrayList> route) { super(context); this.route = route; @@ -40,6 +38,7 @@ public class DeliveryCar extends AbstractBehavior { @Override public Receive createReceive() { return newReceiveBuilder() + .onMessage(PickupResponse.class, this::onPickupResponse) .onMessage(LoadMessage.class, this::onLoadMessage) .onMessage(PickupResponse.class, this::onPickupResponse) .onMessage(StartRoute.class, msg->{ @@ -78,6 +77,9 @@ public class DeliveryCar extends AbstractBehavior { //Wenn fertig iteriert so geht der Wagen an den Verteilerzentrum if(globalIndex==4){ DistributionCenter.ArriveMessage antwort = new DistributionCenter.ArriveMessage(pakete,getContext().getSelf()); + //ActorRef antwort1; + // antwort1.tell(antwort); + //Fehlende Antwort an den Verteilerzentrum @@ -90,16 +92,20 @@ public class DeliveryCar extends AbstractBehavior { sendPickupMessage(); } } - private Behavior onStartRoute(){ - if(globalIndex==0){ + public Behavior onStartRoute(){ + /*if(globalIndex==0){ checkNextStop(); return this; + }else{ if(globalIndex==4) { globalIndex = 0; onStartRoute(); } } + return this;*/ + globalIndex = 0; + checkNextStop(); return this; } @@ -120,7 +126,7 @@ public class DeliveryCar extends AbstractBehavior { if(pakete.get(globalIndex).empfaenger == nextCustomer ) { nextCustomer.tell(new Customer.DeliveryMessage(paket)); pakete.remove(globalIndex); - globalIndex++; + // globalIndex++; } } diff --git a/src/main/java/com/example/DistributionCenter.java b/src/main/java/com/example/DistributionCenter.java index 909529a..f2b6fdd 100644 --- a/src/main/java/com/example/DistributionCenter.java +++ b/src/main/java/com/example/DistributionCenter.java @@ -14,7 +14,11 @@ import java.util.List; public class DistributionCenter extends AbstractBehavior { private final ActorRef addressBook; + public static class StartAllRoutes implements Message {} + private final List lagerraum = new ArrayList<>(); + private final List> deliveryCars = new ArrayList<>(); + private DistributionCenter(ActorContext context, ActorRef addressBook) { super(context); @@ -91,6 +95,7 @@ public class DistributionCenter extends AbstractBehavior> route = generateRandomRoute(customers); + /*List> route = generateRandomRoute(customers); getContext().spawn(DeliveryCar.create(route), "deliveryCar" + i+1); - getContext().getLog().info("Lieferwagen {} erstellt mit Route: {}", i+1, route.toString()); + getContext().getLog().info("Lieferwagen {} erstellt mit Route: {}", i+1, route.toString());*/ + List> route = generateRandomRoute(customers); + ActorRef deliveryCar = getContext().spawn(DeliveryCar.create(route), "deliveryCar" + (i + 1)); + getContext().getLog().info("Lieferwagen {} erstellt mit Route: {}", i + 1, route.toString()); + deliveryCar.tell(new DeliveryCar.StartRoute()); + } + + + + } + private Behavior onStartAllRoutes(StartAllRoutes msg) { + for (ActorRef deliveryCar : deliveryCars) { + deliveryCar.tell(new DeliveryCar.StartRoute()); + } + return this; } // Dummy-Methode zum Generieren einer zufälligen Route