From 379ead193aff5ab33afad6a1c9777f1063c05d8b Mon Sep 17 00:00:00 2001 From: chris Date: Mon, 29 Aug 2022 13:36:34 +0200 Subject: [PATCH] =?UTF-8?q?Erweiterung=20der=20poll=20um=20den=20Fall=20da?= =?UTF-8?q?s=20zwei=20Tickets=20die=20gleiche=20h=C3=B6chste=20Priorit?= =?UTF-8?q?=C3=A4t=20haben?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/testat_g11/SimplePriorityQueue.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/SimplePriorityQueue/src/testat_g11/SimplePriorityQueue.java b/SimplePriorityQueue/src/testat_g11/SimplePriorityQueue.java index 384bdf3..2dd79db 100644 --- a/SimplePriorityQueue/src/testat_g11/SimplePriorityQueue.java +++ b/SimplePriorityQueue/src/testat_g11/SimplePriorityQueue.java @@ -63,6 +63,17 @@ public class SimplePriorityQueue implements IPriorityQueue } } + // Der Fall 2 Tickets haben die gleiche HöchstPrio + for (int i = 0; i < size; i++) { + if (prioDet.calculate(tickets[i]) == prioDet.calculate(tick) & !tickets[i].equals(tick)) { + if (tick.getBeginOfTicket() != null && tickets[i].getBeginOfTicket() != null) { + if (tick.getBeginOfTicket().after(tickets[i].getBeginOfTicket())) { + tick = tickets[i]; + } + } + } + } + remove(tick); return tick; }