Package javatro.display
Class Parser
java.lang.Object
javatro.display.Parser
Handles parsing and validation of user input for the Javatro application.
This class is responsible for:
- Processing user input for card selections and menu navigation
- Validating input ranges, formats, and constraints
- Notifying registered observers of valid user input changes
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidRegisters an observer to listen for user input changes.getCardInput(int maxCardsAvailable, int maxCardsToSelect) Collects and validates card selection input from the user.voidHandles user input for menu navigation and notifies observers.
-
Constructor Details
-
Parser
public Parser()
-
-
Method Details
-
addPropertyChangeListener
Registers an observer to listen for user input changes.- Parameters:
pcl- the property change listener to register- Throws:
JavatroException- if the provided listener isnull
-
getOptionInput
Handles user input for menu navigation and notifies observers.This method:
- Displays current screen options
- Validates input is within allowed range
- Notifies listeners of valid input
- Handles input errors with appropriate error messages
- Throws:
JavatroException- if no options are available in current screen
-
getCardInput
Collects and validates card selection input from the user.- Parameters:
maxCardsAvailable- maximum number of available cards (1-based)maxCardsToSelect- maximum number of cards allowed for selection- Returns:
- unmodifiable list of 0-based card indices
-