Esempio n. 1
0
  public BattleCommand getUserBattleCommand(String s) {
    String word1 = null;

    StringTokenizer tokenizer = new StringTokenizer(s);

    if (tokenizer.hasMoreTokens()) word1 = tokenizer.nextToken();

    return new BattleCommand(commands.getBattleCommandWord(word1));
  }
Esempio n. 2
0
  public Command getUserCommand(String s) {
    String word1 = null;
    String word2 = null;

    // Find up to two words on the line.
    StringTokenizer tokenizer = new StringTokenizer(s);

    if (tokenizer.hasMoreTokens()) {
      word1 = tokenizer.nextToken(); // get first word
      if (tokenizer.hasMoreTokens()) {
        word2 = tokenizer.nextToken(); // get second word
        // note: we just ignore the rest of the input line.
      }
    }

    return new Command(commands.getCommandWord(word1), word2);
  }
Esempio n. 3
0
 public String showAllBattleCommands() {
   return commands.dspAllBattleCommands();
 }