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...
| 35 | This implementation uses a trivial linear search and comparison... |
| 36 | */ |
| 37 | public class NameCompletionTable extends ArrayList |
| 38 | implements NameCompletion |
| 39 | { |
| 40 | /** Unimplemented - need a collection here */ |
| 41 | NameCompletionTable table; |
| 42 | List sources; |
| 43 | |
| 44 | /** Unimplemented - need a collection of sources here*/ |
| 45 | |
| 46 | /** |
| 47 | */ |
| 48 | public NameCompletionTable() { } |
| 49 | |
| 50 | /** |
| 51 | Add a NameCompletionTable, which is more optimized than the more |
| 52 | general NameSource |
| 53 | */ |
| 54 | public void add( NameCompletionTable table ) { |
| 55 | /** Unimplemented - need a collection here */ |
| 56 | if ( this.table != null ) |
| 57 | throw new RuntimeException("Unimplemented usage error"); |
| 58 | |
| 59 | this.table = table; |
| 60 | } |
| 61 | |
| 62 | /** |
| 63 | Add a NameSource which is monitored for names. |
| 64 | Unimplemented - behavior is broken... no updates |
| 65 | */ |
| 66 | public void add( NameSource source ) { |
| 67 | /* |
| 68 | Unimplemented - |
| 69 | Need to add an inner class util here that holds the source and |
| 70 | monitors it by registering a listener |
| 71 | */ |
| 72 | if ( sources == null ) |
| 73 | sources = new ArrayList(); |
| 74 | |
| 75 | sources.add( source ); |
| 76 | } |
| 77 | |
| 78 | /** |
| 79 | Add any matching names to list (including any from other tables) |
| 80 | */ |
| 81 | protected void getMatchingNames( String part, List found ) |
| 82 | { |
| 83 | // check our table |
| 84 | for( int i=0; i< size(); i++ ) { |
| 85 | String name = (String)get(i); |
| 86 | if ( name.startsWith( part ) ) |
| 87 | found.add( name ); |
| 88 | } |
| 89 | |
| 90 | // Check other tables. |
| 91 | /** Unimplemented - need a collection here */ |
| 92 | if ( table != null ) |
| 93 | table.getMatchingNames( part, found ); |
| 94 |
nothing calls this directly
no outgoing calls
no test coverage detected