Package games.stendhal.common.grammar

Examples of games.stendhal.common.grammar.ItemParserResult.wasFound()


    Set<String> items = new HashSet<String>();
    items.add("gold");
    Behaviour beh = new Behaviour(items);
    ItemParserResult res = beh.parse(sentence);
    assertTrue(res.wasFound()); // only gold, silver -> unambiguous
    assertEquals(50, res.getAmount());
    assertEquals("gold", res.getChosenItemName());

    items.add("silver");
    beh = new Behaviour(items);
View Full Code Here


    assertEquals("gold", res.getChosenItemName());

    items.add("silver");
    beh = new Behaviour(items);
    res = beh.parse(sentence);
    assertFalse(res.wasFound()); // gold, silver -> ambiguous
    assertEquals(50, res.getAmount());
  }

}
View Full Code Here

    if (sentence.hasError()) {
      fireSentenceError(player, sentence, npc);
    } else {
      ItemParserResult res = behaviour.parse(sentence);

      if (res.wasFound()) {
        fireRequestOK(res, player, sentence, npc);
      } else {
        fireRequestError(res, player, sentence, npc);
      }
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.