Class Parser


  • public class Parser
    extends java.lang.Object
    This class is part of "World of Zuul". "World of Zuul" is a simple, text based adventure game. This parser takes user input and tries to interpret it as a "Zuul" command. Every time it is called it takes a line as a String and tries to interpret the line as a two word command. It returns the command as an object of class Command. The parser has a set of known command words. It checks user input against the known commands, and if the input is not one of the known commands, it returns a command object that is marked as an unknown command.
    Version:
    2.0 (Jan 2003) DB edited (2019)
    Author:
    Michael Kolling and David J. Barnes
    • Constructor Summary

      Constructors 
      Constructor Description
      Parser()
      Create a new Parser.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Command getCommand​(java.lang.String pInputLine)
      Get a new command from the user.
      java.lang.String getCommandString()
      Returns a String with valid command words.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Parser

        public Parser()
        Create a new Parser.
    • Method Detail

      • getCommand

        public Command getCommand​(java.lang.String pInputLine)
        Get a new command from the user. The command is read by parsing the 'inputLine'.
        Parameters:
        pInputLine - Lis la String entrée.
        Returns:
        une commande
      • getCommandString

        public java.lang.String getCommandString()
        Returns a String with valid command words.
        Returns:
        la String avec les commandes valides.