Class UpdateId

java.lang.Object
commandManagers.Command
commandManagers.commands.UpdateId
All Implemented Interfaces:
CommandInterface

public class UpdateId extends Command
Command to update a city by its id number.
  • Constructor Details

    • UpdateId

      public UpdateId()
      Default constructor from 1.0
    • UpdateId

      public UpdateId(ModeManager<City> modeManager)
      Provides choosing handler
      Parameters:
      modeManager - ModuleHandler for operating
      Since:
      1.1
  • Method Details

    • getName

      public String getName()
      Description copied from class: Command
      Base method for show command name
      Specified by:
      getName in interface CommandInterface
      Specified by:
      getName in class Command
      Returns:
      command name
    • getDescr

      public String getDescr()
      Description copied from class: Command
      Base method for show command description.
      Specified by:
      getDescr in interface CommandInterface
      Specified by:
      getDescr in class Command
      Returns:
      command description
    • execute

      public void execute() throws BuildObjectException
      Executes the UpdateId command by updating a city with a specified id number in the collection. The method calls the checkArgument method to validate the input argument before execution.
      Specified by:
      execute in interface CommandInterface
      Specified by:
      execute in class Command
      Throws:
      BuildObjectException
    • checkArgument

      public boolean checkArgument(Object inputArgument)
      Checks if the input argument is valid for the UpdateId command. The input argument should be a non-null string that can be parsed to an integer.
      Specified by:
      checkArgument in interface CommandInterface
      Specified by:
      checkArgument in class Command
      Parameters:
      inputArgument - the input argument to be checked
      Returns:
      true if the input argument is valid, false otherwise