# Class CommandParser

java.lang.Object
it.polimi.ingsw.is25am31.view.tui.input.CommandParser

public class CommandParser extends Object
Parses user input commands and dispatches them to the appropriate handler. It validates commands based on the current `ClientState` to ensure that only allowed actions are processed.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `CommandParser(VirtualServer server, ClientModel model, UiRenderer renderer)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `handleInput(String input)`
  Handles an input string from the user.
  `void`
  `setClientId(UUID clientId)`
  Sets the client identifier for the underlying `CommandHandler`.
  `void`
  `setNotified()`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### CommandParser

    public CommandParser(VirtualServer server, ClientModel model, UiRenderer renderer)

- ## Method Details

  - ### setClientId

    public void setClientId(UUID clientId)
    Sets the client identifier for the underlying `CommandHandler`.
    Parameters:
      `clientId` - The `UUID` of the client.

  - ### setNotified

    public void setNotified()

  - ### handleInput

    public void handleInput(String input) throws Exception
    Handles an input string from the user. It first validates the command, then checks if it's allowed in the current client state, and finally parses and dispatches it to the `CommandHandler`.
    Parameters:
      `input` - The string input from the user.
    Throws:
      `Exception` - if an error occurs during command parsing or handling.