|
|
@ -49,8 +49,22 @@ public class SimplePriorityQueue<T extends Ticket> implements IPriorityQueue<T> |
|
|
|
// Methode incrementAge() erhöht (Siehe Ticket im Paket testat_g11)
|
|
|
|
@Override |
|
|
|
public T poll() { |
|
|
|
// TODO Auto-generated method stub
|
|
|
|
return null; |
|
|
|
if (size == 0) { |
|
|
|
return null; |
|
|
|
} |
|
|
|
T tick = tickets[0]; |
|
|
|
|
|
|
|
for (int i = 1; i < size; i++) { |
|
|
|
if (prioDet.calculate(tickets[i]) > prioDet.calculate(tick)) { |
|
|
|
tick.incrementAge(); |
|
|
|
tick = tickets[i]; |
|
|
|
} else { |
|
|
|
tickets[i].incrementAge(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
remove(tick); |
|
|
|
return tick; |
|
|
|
} |
|
|
|
|
|
|
|
// True: Ticket t ist enthalten, false sonst
|
|
|
|