Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 /*
  * Copyright (C) 2011 The Guava Authors
  *
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
  * in compliance with the License. You may obtain a copy of the License at
  *
  * http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software distributed under the
 * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
 * express or implied. See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.google.common.collect;
import static com.google.common.base.Preconditions.checkNotNull;
A rule for a local mutation to a binary search tree, that changes at most one entry. In addition to specifying how it modifies a particular entry via a BstModifier, it specifies a BstBalancePolicy for rebalancing the tree after the modification is performed and a BstNodeFactory for constructing newly rebalanced nodes.

Parameters:
<K> The key type of the nodes in binary search trees that this rule can modify.
<N> The type of the nodes in binary search trees that this rule can modify.
Author(s):
Louis Wasserman
final class BstMutationRule<K, N extends BstNode<K, N>> {
  
Constructs a BstMutationRule with the specified modifier, balance policy, and node factory.
  public static <K, N extends BstNode<K, N>> BstMutationRule<K, N> createRule(
      BstModifier<K, N> modifierBstBalancePolicy<N> balancePolicy,
      BstNodeFactory<N> nodeFactory) {
    return new BstMutationRule<K, N>(modifierbalancePolicynodeFactory);
  }
  private final BstModifier<K, N> modifier;
  private final BstBalancePolicy<N> balancePolicy;
  private final BstNodeFactory<N> nodeFactory;
  private BstMutationRule(BstModifier<K, N> modifierBstBalancePolicy<N> balancePolicy,
      BstNodeFactory<N> nodeFactory) {
    this. = checkNotNull(balancePolicy);
    this. = checkNotNull(nodeFactory);
    this. = checkNotNull(modifier);
  }

  
Returns the BstModifier that specifies the change to a targeted entry in a binary search tree.
  public BstModifier<K, N> getModifier() {
    return ;
  }

  
Returns the policy used to rebalance nodes in the tree after this modification has been performed.
    return ;
  }

  
Returns the node factory used to create new nodes in the tree after this modification has been performed.
  public BstNodeFactory<N> getNodeFactory() {
    return ;
  }
New to GrepCode? Check out our FAQ X