Lines Matching refs:left

52           BstNodeFactory<N> nodeFactory, N source, @Nullable N left, @Nullable N right) {
53 return checkNotNull(nodeFactory).createNode(source, left, right);
58 public N combine(BstNodeFactory<N> nodeFactory, @Nullable N left, @Nullable N right) {
59 if (left == null) {
62 return left;
63 } else if (countAggregate.treeValue(left) > countAggregate.treeValue(right)) {
65 left, left.childOrNull(LEFT), combine(nodeFactory, left.childOrNull(RIGHT), right));
67 return nodeFactory.createNode(right, combine(nodeFactory, left, right.childOrNull(LEFT)),
85 BstNodeFactory<N> nodeFactory, N source, @Nullable N left, @Nullable N right) {
86 long countL = countAggregate.treeValue(left);
90 return rotateL(nodeFactory, source, left, right);
92 return rotateR(nodeFactory, source, left, right);
95 return nodeFactory.createNode(source, left, right);
98 private N rotateL(BstNodeFactory<N> nodeFactory, N source, @Nullable N left, N right) {
105 return singleL(nodeFactory, source, left, right);
108 private N rotateR(BstNodeFactory<N> nodeFactory, N source, N left, @Nullable N right) {
109 checkNotNull(left);
110 N lr = left.childOrNull(RIGHT);
111 N ll = left.childOrNull(LEFT);
113 left = singleL(nodeFactory, left, ll, lr);
115 return singleR(nodeFactory, source, left, right);
118 private N singleL(BstNodeFactory<N> nodeFactory, N source, @Nullable N left, N right) {
121 nodeFactory.createNode(source, left, right.childOrNull(LEFT)),
125 private N singleR(BstNodeFactory<N> nodeFactory, N source, N left, @Nullable N right) {
126 checkNotNull(left);
127 return nodeFactory.createNode(left, left.childOrNull(LEFT),
128 nodeFactory.createNode(source, left.childOrNull(RIGHT), right));
133 public N combine(BstNodeFactory<N> nodeFactory, @Nullable N left, @Nullable N right) {
134 if (left == null) {
137 return left;
140 if (countAggregate.treeValue(left) > countAggregate.treeValue(right)) {
141 BstMutationResult<K, N> extractLeftMax = extractMax(left, nodeFactory, this);
143 left = extractLeftMax.getChangedRoot();
149 return nodeFactory.createNode(newRootSource, left, right);
167 BstNodeFactory<N> nodeFactory, N source, @Nullable N left, @Nullable N right) {
168 if (left == null) {
171 return insertMax(left, source, nodeFactory, singleBalancePolicy);
173 long countL = countAggregate.treeValue(left);
176 N resultLeft = balance(nodeFactory, source, left, right.childOrNull(LEFT));
180 N resultRight = balance(nodeFactory, source, left.childOrNull(RIGHT), right);
182 nodeFactory, left, left.childOrNull(LEFT), resultRight);
184 return nodeFactory.createNode(source, left, right);
190 public N combine(BstNodeFactory<N> nodeFactory, @Nullable N left, @Nullable N right) {
191 if (left == null) {
194 return left;
196 long countL = countAggregate.treeValue(left);
199 N resultLeft = combine(nodeFactory, left, right.childOrNull(LEFT));
203 N resultRight = combine(nodeFactory, left.childOrNull(RIGHT), right);
205 nodeFactory, left, left.childOrNull(LEFT), resultRight);
207 return singleBalancePolicy.combine(nodeFactory, left, right);