Package commandManagers.commands
Class RemoveById
java.lang.Object
commandManagers.Command
commandManagers.commands.RemoveById
- All Implemented Interfaces:
CommandInterface
Class RemoveById provides removal of an element from the collection by its ID number.
Extends the Command class.
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new command with the specified argument requirement. -
Method Summary
Modifier and TypeMethodDescriptionboolean
checkArgument
(Object inputArgument) Checks if the given inputArgument is valid for this command.void
execute()
Overrides the method execute() in the Command class.getDescr()
Base method for show command description.getName()
Base method for show command nameMethods inherited from class commandManagers.Command
getArgument, isHasArgument, setArgument
-
Constructor Details
-
RemoveById
public RemoveById()Constructs a new command with the specified argument requirement.
-
-
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()Overrides the method execute() in the Command class. Removes an element from the collection by its ID number. Checks the argument before execution.- Specified by:
execute
in interfaceCommandInterface
- Specified by:
execute
in classCommand
-
checkArgument
Description copied from class:Command
Checks if the given inputArgument is valid for this command.- Specified by:
checkArgument
in interfaceCommandInterface
- Specified by:
checkArgument
in classCommand
- Parameters:
inputArgument
- the argument to check.- Returns:
- true if the argument is valid, false otherwise.
-