bsh.util

Class NameCompletionTable

Implemented Interfaces:
NameCompletion

public class NameCompletionTable
extends ArrayList
implements NameCompletion

NameCompletionTable is a utility that implements simple name completion for a collection of names, NameSources, and other NameCompletionTables. This implementation uses a trivial linear search and comparison...

Constructor Summary

NameCompletionTable()

Method Summary

void
add(NameSource source)
Add a NameSource which is monitored for names.
void
add(NameCompletionTable table)
Add a NameCompletionTable, which is more optimized than the more general NameSource
String[]
completeName(String part)
Return an array containing a string element of the maximum unambiguous namespace completion or, if there is no common prefix, return the list of ambiguous names.
protected void
getMatchingNames(String part, List found)
Add any matching names to list (including any from other tables)

Constructor Details

NameCompletionTable

public NameCompletionTable()

Method Details

add

public void add(NameSource source)
Add a NameSource which is monitored for names. Unimplemented - behavior is broken... no updates


add

public void add(NameCompletionTable table)
Add a NameCompletionTable, which is more optimized than the more general NameSource


completeName

public String[] completeName(String part)
Return an array containing a string element of the maximum unambiguous namespace completion or, if there is no common prefix, return the list of ambiguous names. e.g. input: "java.l" output: [ "java.lang." ] input: "java.lang." output: [ "java.lang.Thread", "java.lang.Integer", ... ] Note: Alternatively, make a NameCompletionResult object someday...
Specified by:
completeName in interface NameCompletion


getMatchingNames

protected void getMatchingNames(String part,
                                List found)
Add any matching names to list (including any from other tables)


B) 2000-2005 pat@pat.net :-)