Package org.cis1200
Class CommandParser
java.lang.Object
org.cis1200.CommandParser
The
CommandParser
class includes a single static method that can
convert a String into the appropriate Command
object that
it represents.
You do not need to modify this file.-
Method Summary
-
Method Details
-
parse
Parses a string received from a client into its component parts, and creates aCommand
object representing it. The commandString has the form "COMMAND param0? param1? :? payload?" where the COMMAND is one of "CREATE", "INVITE", etc. and may be followed by zero, one or two parameters, and optionally a payload. See the toString methods of the various Command subclasses for the formatting of various commands.- Parameters:
senderId
- The userId for the sender of the commandcommandString
- The command string to parse- Returns:
- a subclass of
Command
corresponding to the string - Throws:
IllegalArgumentException
- if the commandString is syntactically invalid, meaning that it is of an unrecognized type or its components do not match its type.
-