001 /* 002 * Copyright (c) 2002-2007, Marc Prud'hommeaux. All rights reserved. 003 * 004 * This software is distributable under the BSD license. See the terms of the 005 * BSD license in the documentation provided with this software. 006 */ 007 package jline; 008 009 import java.util.*; 010 011 /** 012 * A Completor is the mechanism by which tab-completion candidates 013 * will be resolved. 014 * 015 * @author <a href="mailto:mwp1@cornell.edu">Marc Prud'hommeaux</a> 016 */ 017 public interface Completor { 018 /** 019 * Populates <i>candidates</i> with a list of possible 020 * completions for the <i>buffer</i>. The <i>candidates</i> 021 * list will not be sorted before being displayed to the 022 * user: thus, the complete method should sort the 023 * {@link List} before returning. 024 * 025 * 026 * @param buffer the buffer 027 * @param candidates the {@link List} of candidates to populate 028 * @return the index of the <i>buffer</i> for which 029 * the completion will be relative 030 */ 031 int complete(String buffer, int cursor, List candidates); 032 }