bsh.util
Class NameCompletionTable

java.lang.Object
  |
  +--java.util.AbstractCollection
        |
        +--java.util.AbstractList
              |
              +--java.util.ArrayList
                    |
                    +--bsh.util.NameCompletionTable
All Implemented Interfaces:
java.lang.Cloneable, java.util.Collection, java.util.List, NameCompletion, java.util.RandomAccess, java.io.Serializable

public class NameCompletionTable
extends java.util.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...

See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
NameCompletionTable()
           
 
Method Summary
 void add(NameCompletionTable table)
          Add a NameCompletionTable, which is more optimized than the more general NameSource
 void add(NameSource source)
          Add a NameSource which is monitored for names.
 java.lang.String[] completeName(java.lang.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(java.lang.String part, java.util.List found)
          Add any matching names to list (including any from other tables)
 
Methods inherited from class java.util.ArrayList
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, get, indexOf, isEmpty, lastIndexOf, remove, removeRange, set, size, toArray, toArray, trimToSize
 
Methods inherited from class java.util.AbstractList
equals, hashCode, iterator, listIterator, listIterator, subList
 
Methods inherited from class java.util.AbstractCollection
containsAll, remove, removeAll, retainAll, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
containsAll, equals, hashCode, iterator, listIterator, listIterator, remove, removeAll, retainAll, subList
 

Constructor Detail

NameCompletionTable

public NameCompletionTable()
Method Detail

add

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


add

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


getMatchingNames

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


completeName

public java.lang.String[] completeName(java.lang.String part)
Description copied from interface: NameCompletion
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


2000 pat@pat.net :-)