Class NewActivityCommand

java.lang.Object
gov.nasa.jpl.command.NewActivityCommand
All Implemented Interfaces:
Command

public class NewActivityCommand extends Object implements Command
This class takes in a class object and object array of parameters for that class and then instantiates the class.
  • Constructor Summary

    Constructors
    Constructor
    Description
    NewActivityCommand(String commandString)
    This function parses an input commandString and stores the variables needed to execute a newActivity command.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    This method adds the new activity instance to the plan.
    void
    Undoes the NewActivityCommand by removing the activity with the ID of the newly added activity.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • NewActivityCommand

      public NewActivityCommand(String commandString)
      This function parses an input commandString and stores the variables needed to execute a newActivity command. This includes an activity name followed by parameter type value pairs, separated by commas. Ex: ActivityOne (String "hello", Integer 1)
      Parameters:
      commandString - - string of activity name followed by parameter type/value pairs
  • Method Details

    • execute

      public void execute() throws CommandException
      This method adds the new activity instance to the plan.
      Specified by:
      execute in interface Command
      Throws:
      CommandException
    • unExecute

      public void unExecute() throws CommandException
      Undoes the NewActivityCommand by removing the activity with the ID of the newly added activity. This is implemented by calling a new RemoveActivityCommand on the ID of the activity.
      Specified by:
      unExecute in interface Command
      Throws:
      CommandException