Package commandManagers.commands
Class AddIfMin
java.lang.Object
commandManagers.Command
commandManagers.commands.AddIfMin
- All Implemented Interfaces:
CommandInterface
Command to add a new city to the collection if it has a smaller population than the smallest city in the collection.
- Author:
- boris
-
Constructor Summary
ConstructorsConstructorDescriptionAddIfMin()
Default constructor from 1.0AddIfMin
(ModeManager<City> handler) Provides choosing handler -
Method Summary
Modifier and TypeMethodDescriptionboolean
checkArgument
(Object inputArgument) Checks whether an argument is provided or not.void
execute()
Adds a new city to the collection if its population is less than the population of the smallest city 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
-
AddIfMin
public AddIfMin()Default constructor from 1.0 -
AddIfMin
Provides choosing handler- Parameters:
handler
- ModuleHandler for operating- Since:
- 2.0
-
-
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
Adds a new city to the collection if its population is less than the population of the smallest city in the collection. Prints a message indicating that the command does not take arguments if an argument is provided.- Specified by:
execute
in interfaceCommandInterface
- Specified by:
execute
in classCommand
- Throws:
BuildObjectException
-
checkArgument
Checks whether an argument is provided or not.- Specified by:
checkArgument
in interfaceCommandInterface
- Specified by:
checkArgument
in classCommand
- Parameters:
inputArgument
- the argument to be checked.- Returns:
- true if no argument is provided and false otherwise.
-