Home | History | Annotate | Download | only in collect
      1 /*
      2  * Copyright (C) 2011 The Guava Authors
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
      5  * in compliance with the License. You may obtain a copy of the License at
      6  *
      7  * http://www.apache.org/licenses/LICENSE-2.0
      8  *
      9  * Unless required by applicable law or agreed to in writing, software distributed under the
     10  * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
     11  * express or implied. See the License for the specific language governing permissions and
     12  * limitations under the License.
     13  */
     14 
     15 package com.google.common.collect;
     16 
     17 import com.google.common.annotations.GwtCompatible;
     18 
     19 /**
     20  * A factory for extending paths in a binary search tree.
     21  *
     22  * @author Louis Wasserman
     23  * @param <N> The type of binary search tree nodes used in the paths generated by this {@code
     24  *        BstPathFactory}.
     25  * @param <P> The type of paths constructed by this {@code BstPathFactory}.
     26  */
     27 @GwtCompatible
     28 interface BstPathFactory<N extends BstNode<?, N>, P extends BstPath<N, P>> {
     29   /**
     30    * Returns this path extended by one node to the specified {@code side}.
     31    */
     32   P extension(P path, BstSide side);
     33 
     34   /**
     35    * Returns the trivial path that starts at {@code root} and goes no further.
     36    */
     37   P initialPath(N root);
     38 }
     39