Methods Summary |
---|
private java.lang.String[] | allCommands()
final Set<String> set = allCommandsMap.keySet();
return (String[])set.toArray(new String[set.size()]);
|
private java.lang.String[] | findCommands(java.lang.String pattern)
try
{
List<String> allCommandsList = new Vector<String>(allCommandsMap.keySet());
//sort commands in alphabetical order
Collections.sort(allCommandsList);
List<String> matchedCommands = new Vector();
for (int ii=0; ii+1<allCommandsList.size();ii++)
{
// System.out.println("Matching pattern : " + allCommandsList.get(ii) + " " + pattern);
if (allCommandsList.get(ii).matches(pattern)) {
matchedCommands.add(allCommandsList.get(ii));
}
}
return (String[])matchedCommands.toArray(new String[matchedCommands.size()]);
}
catch (PatternSyntaxException pse)
{
throw new CommandException("InvalidPattern", pse);
}
catch (Exception e){
throw new CommandException(e);
}
|
public static java.lang.String[] | getAllCommands()returns all the valid commands
return new SearchCommands().allCommands();
|
public static java.lang.String[] | getMatchedCommands(java.lang.String pattern)returns commands that matches the pattern
return new SearchCommands().findCommands(pattern);
|