private void allCorrect() {
    int reg;
    for (reg = 0; reg < NUM_REGISTERS; reg++) {

      boolean allAcks = true;
      int i;
      for (i = 0; (i < correct.getSize()) && allAcks; i++) {
        SampleProcess p = correct.getProcess(i);
        if (p.isCorrect() && !writeSet.get(reg).contains(p)) allAcks = false;
      }
      if (allAcks) {
        writeSet.get(reg).clear();

        try {
          SharedWriteReturn ev = new SharedWriteReturn(mainchannel, Direction.UP, this);
          ev.reg = reg;
          ev.go();

          debug("Sent WriteReturn");
        } catch (AppiaEventException ex) {
          ex.printStackTrace();
        }
      }
    }
  }
  private void debugAll(String s) {
    if ((debug == null) || !debugFull) return;
    int i;
    debug.println("DEBUG ALL - " + s);

    for (i = 0; i < NUM_REGISTERS; i++) {
      debug.println("\tvalue[" + i + "]=" + value[i]);
      debug.print("\twriteSet[" + i + "]=");

      for (SampleProcess p : writeSet.get(i)) debug.print(p.getProcessNumber() + ",");
      debug.println();
    }

    debug.print("\tcorrect=");
    for (i = 0; i < correct.getSize(); i++) {
      SampleProcess p = correct.getProcess(i);
      debug.print(
          "[" + p.getProcessNumber() + ";" + p.getSocketAddress() + ";" + p.isCorrect() + "],");
    }
    debug.println();

    debug.println();
  }