Package games.stendhal.common.parser

Examples of games.stendhal.common.parser.NameSearch


      }

      return new ItemParserResult(false, chosenName, amount, null);
    }

    NameSearch search = sentence.findMatchingName(itemNames);

    boolean found = search.found();

    // Store found name.
    String chosenName = search.getName();
    int amount = search.getAmount();
    Set<String> mayBeItems = null;

    if (!found) {
      if ((sentence.getNumeralCount() == 1)
          && (sentence.getUnknownTypeCount() == 0)
View Full Code Here


    Set<String> names = new HashSet<String>();
    names.add("pestle");
    names.add("mortar");
    names.add("cow");
    names.add("horse");
    NameSearch found = sentence.findMatchingName(names);
    assertTrue(found.found());
    assertEquals(1, found.getAmount());
    assertEquals("horse", found.getName());
  }
View Full Code Here

    assertFalse(sentence.hasError());
    assertEquals("i/SUB-PRO own/VER pig/OBJ-ANI-PLU, cow/OBJ-ANI, horse/SUB-ANI.", sentence.toString());

    Set<String> names = new HashSet<String>();
    names.add("horses");
    NameSearch found = sentence.findMatchingName(names);
    assertTrue(found.found());
    assertEquals(1, found.getAmount());
    assertEquals("horses", found.getName());

    names = new HashSet<String>();
    names.add("pig");
    found = sentence.findMatchingName(names);
    assertTrue(found.found());
    assertEquals(2, found.getAmount());
    assertEquals("pig", found.getName());

    names = new HashSet<String>();
    names.add("pigs");
    found = sentence.findMatchingName(names);
    assertTrue(found.found());
    assertEquals(2, found.getAmount());
    assertEquals("pigs", found.getName());
  }
View Full Code Here

TOP

Related Classes of games.stendhal.common.parser.NameSearch

Copyright © 2018 www.massapicom. 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.