Package javatro.manager.options
Class CardSelectOption
java.lang.Object
javatro.manager.options.CardSelectOption
- All Implemented Interfaces:
Option
The
CardSelectOption class handles card selection operations for the player, allowing
them to either play cards into their current poker hand or discard cards, depending on the active
game screen. The number of selectable cards is limited by a configurable maximum (default: 5).-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intDefault maximum number of cards that can be selected in one operation -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a card selector with default selection limit (5).CardSelectOption(int selectionLimit) Constructs a card selector with a custom selection limit. -
Method Summary
Modifier and TypeMethodDescriptionvoidexecute()Executes the card selection operation.Returns a human-readable description of this command.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface javatro.manager.options.Option
setDescription
-
Field Details
-
DEFAULT_SELECTION_LIMIT
public static final int DEFAULT_SELECTION_LIMITDefault maximum number of cards that can be selected in one operation- See Also:
-
-
Constructor Details
-
CardSelectOption
Constructs a card selector with default selection limit (5).- Throws:
JavatroException- if initialization fails due to internal constraints
-
CardSelectOption
Constructs a card selector with a custom selection limit.- Parameters:
selectionLimit- Maximum number of cards that can be selected (must be ≥ 1)- Throws:
JavatroException- if invalid selection limit is provided
-
-
Method Details
-
getDescription
Returns a human-readable description of this command.- Specified by:
getDescriptionin interfaceOption- Returns:
- Brief string describing the card selection operation
-
execute
Executes the card selection operation. Collects user input, processes the selection based on current context (play/discard), updates game state, and handles game progression.- Specified by:
executein interfaceOption- Throws:
JavatroException- if input parsing fails or game state becomes inconsistent
-