354 {
355
356 if (fqel == qel) return;
357
358
359
360
361
362
363
364
365
366
368 if (aln == NULL) {
371 qel = fqel;
372 return;
373 } else {
374 if (fqel > qel)
375 {
376 long fqel_res = fqel;
377
378
379 if (fqel_res < 2 * qel)
380 {
381 long ex = 2 * qel * size_of_element;
383 fqel_res = 2 * qel;
384 else {
386 if (q <= 0) q = 1;
387 if (fqel_res - qel < q) fqel_res = qel + q;
388 }
389 }
390 long q;
391 long left_old_qel = qel;
392 long left_new_qel = fqel;
393 long left_new_qel_res = fqel_res;
394
395
397 do {
398 q = aln->el.get_qel();
399
400
401
402 if (q >= left_old_qel)
403 {
404 if (q >= left_new_qel)
405 {
406 qel = fqel;
407 return;
408 } else
409 {
410
411 left_new_qel -= q;
412 left_new_qel_res -= q;
414 while (
415 (aln1 = aln->get_next_node()) !=
416 NULL) {
417 aln = aln1;
418 q = aln->
el.get_qel();
419 if (q >= left_new_qel)
420 {
421 qel = fqel;
422 return;
423 }
424 left_new_qel -= q;
425 left_new_qel_res -= q;
426 }
427
430 qel = fqel;
431
432 return;
433 }
434 }
435 left_old_qel -= q;
436 left_new_qel -= q;
437 aln = aln->get_next_node();
438 } while (aln != NULL);
439 mcout <<
"BlkArr<T>::put_qel: should never happen\n";
440 } else
441 {
442 long q;
443 long left_old_qel = qel;
444 long left_new_qel = fqel;
446 do {
447 q = aln->el.get_qel();
448 if (q >= left_new_qel)
449 {
450
451
452 long n;
453 for (n = left_new_qel; n < q; n++) {
454 aln->el[n] = T();
455 }
456 left_old_qel -= q;
457
459 if (aln1 != NULL)
460 {
461 if (left_new_qel != 0)
462 {
463
464 aln = aln1;
465 q = aln->
el.get_qel();
466 if (left_old_qel > 0)
467 {
468 long l = left_old_qel;
469 if (q < l) l = q;
470 for (n = 0; n < l; n++) {
471 aln->el[n] = T();
472 }
473 }
474 }
475 while ((aln1 = aln->get_next_node()) != NULL)
476
477 {
479 }
480 }
481 qel = fqel;
482 return;
483 }
484 left_old_qel -= q;
485 left_new_qel -= q;
486 aln = aln->get_next_node();
487 } while (aln != NULL);
488 qel = fqel;
489 }
490 }
491}
const long max_size_of_extra_increment
AbsListNode< T > * get_next_node(void) const
AbsListNode< T > * insert_after(AbsListNode< T > *an, const T &fel)
void erase(AbsListNode< T > *an)
AbsListNode< T > * get_last_node(void) const