(Comparator<? super E> comparator, @Nullable E e, int count, int[] result)
| 689 | } |
| 690 | |
| 691 | AvlNode<E> setCount(Comparator<? super E> comparator, @Nullable E e, int count, int[] result) { |
| 692 | int cmp = comparator.compare(e, elem); |
| 693 | if (cmp < 0) { |
| 694 | AvlNode<E> initLeft = left; |
| 695 | if (initLeft == null) { |
| 696 | result[0] = 0; |
| 697 | return (count > 0) ? addLeftChild(e, count) : this; |
| 698 | } |
| 699 | left = initLeft.setCount(comparator, e, count, result); |
| 700 | if (count == 0 && result[0] != 0) { |
| 701 | this.distinctElements--; |
| 702 | } else if (count > 0 && result[0] == 0) { |
| 703 | this.distinctElements++; |
| 704 | } |
| 705 | this.totalCount += count - result[0]; |
| 706 | return rebalance(); |
| 707 | } else if (cmp > 0) { |
| 708 | AvlNode<E> initRight = right; |
| 709 | if (initRight == null) { |
| 710 | result[0] = 0; |
| 711 | return (count > 0) ? addRightChild(e, count) : this; |
| 712 | } |
| 713 | right = initRight.setCount(comparator, e, count, result); |
| 714 | if (count == 0 && result[0] != 0) { |
| 715 | this.distinctElements--; |
| 716 | } else if (count > 0 && result[0] == 0) { |
| 717 | this.distinctElements++; |
| 718 | } |
| 719 | this.totalCount += count - result[0]; |
| 720 | return rebalance(); |
| 721 | } |
| 722 | |
| 723 | // setting my count |
| 724 | result[0] = elemCount; |
| 725 | if (count == 0) { |
| 726 | return deleteMe(); |
| 727 | } |
| 728 | this.totalCount += count - elemCount; |
| 729 | this.elemCount = count; |
| 730 | return this; |
| 731 | } |
| 732 | |
| 733 | AvlNode<E> setCount(Comparator<? super E> comparator, @Nullable E e, int expectedCount, int newCount, int[] result) { |
| 734 | int cmp = comparator.compare(e, elem); |
nothing calls this directly
no test coverage detected