Ejemplo n.º 1
0
  public void testGetMissing5() {
    Table<Integer> buf = new Table<Integer>(3, 10, 0);
    buf.add(1, 1);
    SeqnoList missing = buf.getMissing();
    System.out.println("missing = " + missing);
    assert missing == null && buf.getNumMissing() == 0;

    buf = new Table<Integer>(3, 10, 0);
    buf.add(10, 10);
    missing = buf.getMissing();
    System.out.println("missing = " + missing);
    assert buf.getNumMissing() == missing.size();

    buf = new Table<Integer>(3, 10, 0);
    buf.add(5, 5);
    missing = buf.getMissing();
    System.out.println("missing = " + missing);
    assert buf.getNumMissing() == missing.size();

    buf = new Table<Integer>(3, 10, 0);
    buf.add(5, 5);
    buf.add(7, 7);
    missing = buf.getMissing();
    System.out.println("missing = " + missing);
    assert missing.size() == 5;
    assert buf.getNumMissing() == missing.size();
  }
Ejemplo n.º 2
0
 public static void testGetMissingFirst() {
   Table<Integer> table = new Table<Integer>(3, 10, 0);
   for (int num : Arrays.asList(2, 3, 4, 5)) table.add(num, num);
   System.out.println("table = " + table);
   SeqnoList missing = table.getMissing();
   System.out.println("missing=" + missing);
   assert missing.size() == 1;
   assert table.getNumMissing() == 1;
 }
Ejemplo n.º 3
0
 public void run() {
   for (Map.Entry<Address, ReceiverEntry> entry : recv_table.entrySet()) {
     Address target = entry.getKey(); // target to send retransmit requests to
     ReceiverEntry val = entry.getValue();
     Table<Message> buf = val != null ? val.received_msgs : null;
     if (buf != null && buf.getNumMissing() > 0) {
       SeqnoList missing = buf.getMissing();
       if (missing != null) retransmit(missing, target);
     }
   }
 }
Ejemplo n.º 4
0
 public void testGetMissing4() {
   Table<Integer> buf = new Table<Integer>(3, 30, 0);
   for (int i : Arrays.asList(2, 5, 10, 11, 12, 13, 15, 20, 28, 30)) buf.add(i, i);
   System.out.println("buf = " + buf);
   int missing = buf.getNumMissing();
   assert missing == 20;
   System.out.println("missing=" + missing);
   SeqnoList missing_list = buf.getMissing();
   System.out.println("missing_list = " + missing_list);
   assert missing_list.size() == missing;
 }