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 TypeMethodDescriptionbooleancheckArgument(Object inputArgument) Checks whether an argument is provided or not.voidexecute()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: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
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:
executein interfaceCommandInterface- Specified by:
executein classCommand- Throws:
BuildObjectException
-
checkArgument
Checks whether an argument is provided or not.- Specified by:
checkArgumentin interfaceCommandInterface- Specified by:
checkArgumentin classCommand- Parameters:
inputArgument- the argument to be checked.- Returns:
- true if no argument is provided and false otherwise.
-