KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > jline > Completor


1 /**
2  * jline - Java console input library
3  * Copyright (c) 2002,2003 Marc Prud'hommeaux mwp1@cornell.edu
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  */

19 package jline;
20
21 import java.io.*;
22 import java.util.*;
23
24 /**
25  * A Completor is the mechanism by which tab-completion candidates
26  * will be resolved.
27  * <p>
28  * <strong>TODO:</strong>
29  * <ul>
30  * <li>handle quotes and escaped quotes</li>
31  * <li>enable automatic escaping of whitespace</li>
32  * </ul>
33  *
34  * @author <a HREF="mailto:mwp1@cornell.edu">Marc Prud'hommeaux</a>
35  */

36 public interface Completor
37 {
38     /**
39      * Populates <i>candidates</i> with a list of possible
40      * completions for the <i>buffer</i>. The <i>candidates</i>
41      * list will not be sorted before being displayed to the
42      * user: thus, the complete method should sort the
43      * {@link List} before returning.
44      *
45      *
46      * @param buffer the buffer
47      * @param candidates the {@link List} of candidates to populate
48      * @return the index of the <i>buffer</i> for which
49      * the completion will be relative
50      */

51     public int complete (String JavaDoc buffer, int cursor, List candidates);
52 }
53
Popular Tags