import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.collect.BstModificationResult.ModificationType.REBUILDING_CHANGE;
import static com.google.common.collect.BstSide.LEFT;
import static com.google.common.collect.BstSide.RIGHT;
The result of a mutation operation performed at a single location in a binary search tree.
<> The key type of the nodes in the modified binary search tree.
<> The type of the nodes in the modified binary search tree.
- Louis Wasserman
targetKey The key targeted for modification. If
changedTarget are non-null, their keys must compare as equal to
originalRoot The root of the subtree that was modified.
changedRoot The root of the subtree, after the modification and any rebalancing.
modificationResult The result of the local modification to an entry.
return new BstMutationResult<K, N>(targetKey, originalRoot, changedRoot, modificationResult);
Returns the key which was the target of this modification.
Returns the root of the subtree that was modified.
Returns the root of the subtree, after the modification and any rebalancing was performed.
Returns the entry in the original subtree with key
, if any. This should not
be treated as a subtree, but only as an entry, and no guarantees are made about its children
when viewed as a subtree.
Returns the result of the modification to
. This should not be
treated as a subtree, but only as an entry, and no guarantees are made about its children when
viewed as a subtree.
If this mutation was to an immediate child subtree of the specified root on the specified
side, returns the
of applying the mutation to the appropriate child
of the specified root and rebalancing using the specified mutation rule.
assert liftOriginalRoot != null & side != null & nodeFactory != null & balancePolicy != null;
balancePolicy.balance(nodeFactory, liftOriginalRoot, resultLeft, resultRight);