@Test public void testShuffled() { for (Integer[] perm : perms) { Group group = new Group("group"); for (Integer i : perm) { Item item = new Item(group, i); group.add(item); } Queueable[] elems = group.getQueue(); for (Queueable elem : elems) { Item item = (Item) elem; // System.out.print( " " + item.getSalience() + "/" + item.getActivationNumber() + // "/" + item.getIndex() ); if (item.getIndex() % 2 == 0) { group.remove(item); group.add(item); } } boolean ok = true; StringBuilder sb = new StringBuilder("queue:"); for (int i = max - 1; i >= 0; i--) { int sal = group.getNext().getSalience(); sb.append(" ").append(sal); if (sal != i) ok = false; } assertTrue("incorrect order in " + sb.toString(), ok); // System.out.println( sb.toString() ); } }
public void remove(Item agendaItem) { this.queue.dequeue(agendaItem.getIndex()); }