Package games.stendhal.common.parser

Examples of games.stendhal.common.parser.CompoundName


    Sentence sentence = ConversationParser.parse("I think this kobold npc up ados city");
    assertFalse(sentence.hasError());
    assertEquals(6, sentence.getExpressions().size());
    assertEquals("i/SUB-PRO think/VER this kobold/SUB-PRO npc/OBJ up/PRE ados city/OBJ", sentence.toString());

    CompoundName cn = wl.searchCompoundName(ConversationParser.parseAsMatchingSource("ados").expressions, 0);
    assertNull(cn);

    cn = wl.searchCompoundName(ConversationParser.parseAsMatchingSource("ados scroll").expressions, 0);
    assertNull(cn);

    cn = wl.searchCompoundName(ConversationParser.parseAsMatchingSource("ados city").expressions, 0);
    assertArrayEquals(new String[]{"ados","city"}, cn.toArray());
    assertNotNull(cn);

    cn = wl.searchCompoundName(ConversationParser.parseAsMatchingSource("ados city scroll").expressions, 0);
    assertArrayEquals(new String[]{"ados","city","scroll"}, cn.toArray());
    assertNotNull(cn);

    cn = wl.searchCompoundName(ConversationParser.parseAsMatchingSource("buy ados city scroll").expressions, 0);
    assertNull(cn);

    cn = wl.searchCompoundName(ConversationParser.parseAsMatchingSource("buy ados city scroll").expressions, 1);
    assertArrayEquals(new String[]{"ados","city","scroll"}, cn.toArray());
    assertNotNull(cn);
  }
View Full Code Here

TOP

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

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.