code: private void reassign() {
      if (member.type() == Member.Type.ACTIVE && !member.equals(context.getLeader())) {
        // Calculate this server's index within the collection of active members, excluding the leader.
        // This is done in a deterministic way by sorting the list of active members by ID.
        int index = 1;
        for (MemberState member : getActiveMemberStates((m1, m2) -> m1.getMember().id() - m2.getMember().id())) {
          if (!member.getMember().equals(context.getLeader())) {
            if (this.member.id() < member.getMember().id()) {
              index++;
            } else {
              break;
            }
          }
        }
  
        // Intersect the active members list with a sorted list of passive members to get assignments.
        List<MemberState> sortedPassiveMembers = getPassiveMemberStates((m1, m2) -> m1.getMember().id() - m2.getMember().id());
        assignedMembers = assignMembers(index, sortedPassiveMembers);
      } else {
        assignedMembers = new ArrayList<>(0);
      }
    }
docs: Rebuilds assigned member states.