Package commandManagers.commands
Class Show
java.lang.Object
commandManagers.Command
commandManagers.commands.Show
- All Implemented Interfaces:
CommandInterface
Command to show all cities in the collection.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
checkArgument
(Object inputArgument) Checks if the input argument is valid for the Show command.void
execute()
Executes the Show command by printing all the cities in the collection.getDescr()
Base method for show command description.getName()
Base method for show command nameMethods inherited from class commandManagers.Command
getArgument, isHasArgument, setArgument
-
Constructor Details
-
Show
public Show()
-
-
Method Details
-
getName
Description copied from class:Command
Base method for show command name- Specified by:
getName
in interfaceCommandInterface
- Specified by:
getName
in classCommand
- Returns:
- command name
-
getDescr
Description copied from class:Command
Base method for show command description.- Specified by:
getDescr
in interfaceCommandInterface
- Specified by:
getDescr
in classCommand
- Returns:
- command description
-
execute
public void execute()Executes the Show command by printing all the cities in the collection. The method calls the checkArgument method to validate the input argument before execution.- Specified by:
execute
in interfaceCommandInterface
- Specified by:
execute
in classCommand
-
checkArgument
Checks if the input argument is valid for the Show command. The input argument should be null.- Specified by:
checkArgument
in interfaceCommandInterface
- Specified by:
checkArgument
in classCommand
- Parameters:
inputArgument
- the input argument to be checked- Returns:
- true if the input argument is valid, false otherwise
-