View Javadoc

1   /*
2    * Copyright (c) 2002-2007, Marc Prud'hommeaux. All rights reserved.
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   package jline;
8   
9   import java.util.*;
10  
11  /***
12   *  A Completor is the mechanism by which tab-completion candidates
13   *  will be resolved.
14   *
15   *  @author  <a href="mailto:mwp1@cornell.edu">Marc Prud'hommeaux</a>
16   */
17  public interface Completor {
18      /***
19       *  Populates <i>candidates</i> with a list of possible
20       *  completions for the <i>buffer</i>. The <i>candidates</i>
21       *  list will not be sorted before being displayed to the
22       *  user: thus, the complete method should sort the
23       *  {@link List} before returning.
24       *
25       *
26       *  @param  buffer     the buffer
27       *  @param  candidates the {@link List} of candidates to populate
28       *  @return            the index of the <i>buffer</i> for which
29       *                     the completion will be relative
30       */
31      int complete(String buffer, int cursor, List candidates);
32  }