src/jdk.internal.le/share/classes/jdk/internal/jline/console/completer/Completer.java
changeset 53333 fd6de53a0d6e
parent 53332 ab474ef0a0ac
parent 53010 086dfcfc3731
child 53334 b94283cb226b
equal deleted inserted replaced
53332:ab474ef0a0ac 53333:fd6de53a0d6e
     1 /*
       
     2  * Copyright (c) 2002-2016, the original author or authors.
       
     3  *
       
     4  * This software is distributable under the BSD license. See the terms of the
       
     5  * BSD license in the documentation provided with this software.
       
     6  *
       
     7  * http://www.opensource.org/licenses/bsd-license.php
       
     8  */
       
     9 package jdk.internal.jline.console.completer;
       
    10 
       
    11 import java.util.List;
       
    12 
       
    13 /**
       
    14  * A completer is the mechanism by which tab-completion candidates will be resolved.
       
    15  *
       
    16  * @author <a href="mailto:mwp1@cornell.edu">Marc Prud'hommeaux</a>
       
    17  * @author <a href="mailto:jason@planet57.com">Jason Dillon</a>
       
    18  * @since 2.3
       
    19  */
       
    20 public interface Completer
       
    21 {
       
    22     //
       
    23     // FIXME: Check if we can use CharSequece for buffer?
       
    24     //
       
    25 
       
    26     /**
       
    27      * Populates <i>candidates</i> with a list of possible completions for the <i>buffer</i>.
       
    28      *
       
    29      * The <i>candidates</i> list will not be sorted before being displayed to the user: thus, the
       
    30      * complete method should sort the {@link List} before returning.
       
    31      *
       
    32      * @param buffer        The buffer
       
    33      * @param cursor        The current position of the cursor in the <i>buffer</i>
       
    34      * @param candidates    The {@link List} of candidates to populate
       
    35      * @return              The index of the <i>buffer</i> for which the completion will be relative
       
    36      */
       
    37     int complete(String buffer, int cursor, List<CharSequence> candidates);
       
    38 }