Package commandManagers.commands
Class Exit
java.lang.Object
commandManagers.Command
commandManagers.commands.Exit
- All Implemented Interfaces:
CommandInterface
The Exit class is a command that terminates the program.
It extends the Command class and overrides its execute() and checkArgument() methods.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancheckArgument(Object inputArgument) Checks if the argument of the Exit command is null.voidexecute()Terminates the program by setting the isWorking variable in UserManager class to false.getDescr()Base method for show command description.getName()Base method for show command nameMethods inherited from class commandManagers.Command
getArgument, isHasArgument, setArgument
-
Constructor Details
-
Exit
public Exit()
-
-
Method Details
-
getName
Description copied from class:CommandBase method for show command name- Specified by:
getNamein interfaceCommandInterface- Specified by:
getNamein classCommand- Returns:
- command name
-
getDescr
Description copied from class:CommandBase method for show command description.- Specified by:
getDescrin interfaceCommandInterface- Specified by:
getDescrin classCommand- Returns:
- command description
-
execute
public void execute()Terminates the program by setting the isWorking variable in UserManager class to false. Prints a message to the console to indicate that the program is terminating. Overrides execute() method of the Command class.- Specified by:
executein interfaceCommandInterface- Specified by:
executein classCommand
-
checkArgument
Checks if the argument of the Exit command is null. If the argument is not null, prints a message to the console indicating that the Exit command does not take any arguments. Overrides the checkArgument() method of the Command class.- Specified by:
checkArgumentin interfaceCommandInterface- Specified by:
checkArgumentin classCommand- Parameters:
inputArgument- the argument of the Exit command- Returns:
- true if the inputArgument is null, false otherwise
-