示例#1
0
 /**
  * Returns a nice formated String of the Commands this class handles
  *
  * @return
  */
 protected final String getCommandsAsString() {
   String res = "";
   for (Cmd c : mCommandMap.values()) {
     res += c.getName();
     if (c.getAlias().length > 0) {
       res += " (";
       for (String s : c.getAlias()) {
         res += s + ", ";
       }
       res = res.substring(0, res.length() - 2) + ")";
     }
     res += ", ";
   }
   return res;
 }
示例#2
0
  CommandHandlerBase(MainService mainService, int cmdType, Object... commands) {
    if (sMainService == null) {
      sMainService = mainService;
      sSettingsMgr = SettingsManager.getSettingsManager(sContext);
      sContext = mainService.getBaseContext();
      Cmd.setContext(sContext);
    }
    mCommandMap = new HashMap<String, Cmd>();
    for (Object o : commands) {
      Cmd c = (Cmd) o;
      mCommandMap.put(c.getName(), c);
    }
    mCmdType = cmdType;
    mAnswerTo = null;

    initializeSubCommands();
  }
示例#3
0
 public boolean isMatchingCmd(String cmdName, String input) {
   Cmd cmd = getCommand(input);
   return cmd != null && cmd.getName().equals(cmdName);
 }