//@@author A0144939R
package seedu.task.logic.commands;

/**
 * Alias command
 */
public class AliasCommand extends Command {
    
    public static final String COMMAND_WORD = "alias";
    
    public static final String MESSAGE_USAGE = COMMAND_WORD + ": Aliases a command to a given string "
            + "Parameters: ALIASED VALUE"
            + "Example: " + COMMAND_WORD
            + "add a";
    
    public static final String MESSAGE_SUCCESS = "Command successfully aliased";
    public static final String MESSAGE_FAILURE = "Error, cannot alias command";
    
    private String command;
    private String alias;
    
    
    public AliasCommand(String command, String alias) {
        this.command = command.trim();
        this.alias = alias.trim();
    }
    

    @Override
    public CommandResult execute() {
      if(isValidAliasCommandPair(alias, command)) {
          model.setMapping(command, alias);
          return new CommandResult(true, MESSAGE_SUCCESS);
      } else {
          return new CommandResult(false, MESSAGE_FAILURE);
      }
    }
    
    public boolean isValidAliasCommandPair(String alias, String command) {
        //check that alias is not null and that alias is not a command
        //checks that command is valid command
        return true;
    }

}


@@ -50,16 +50,116 @@
 mands;%0A%0A
+import seedu.task.commons.logic.CommandKeys;%0Aimport seedu.task.commons.logic.CommandKeys.Commands;%0A%0A
 /**%0A * A
@@ -690,16 +690,22 @@
  command
+String
 ;%0A    pr
@@ -810,16 +810,22 @@
 .command
+String
  = comma
@@ -984,12 +984,93 @@
 mand
-)) %7B
+String)) %7B%0A          Commands command = CommandKeys.commandKeyMap.get(commandString);
 %0A   
@@ -1266,224 +1266,736 @@
     
-%0A    public boolean isValidAliasCommandPair(String alias, String command) %7B%0A        //check that alias is not null and that alias is not a command%0A        //checks that command is valid command%0A        return true;%0A 
+/**%0A     * Checks if a given alias can be mapped to given command%0A     * Note: one command can have multiple aliases%0A     * @param alias Alias specified by user%0A     * @param command Command the alias aliases to%0A     * @return%0A     */%0A    public boolean isValidAliasCommandPair(String alias, String command) %7B%0A        //check that alias is not null and that alias is not a command%0A        //checks that command is valid command%0A        if(alias != null && command != null) %7B%0A            if(CommandKeys.commandKeyMap.containsKey(commandString) && CommandKeys.commandKeyMap.get(commandString) == null) %7B%0A                return true;%0A            %7D else %7B%0A                return false;%0A            %7D%0A        %7D%0A        return false;%0A
    %7D

Check if valid alias