forked from nus-cs2103-AY1920S1/addressbook-level3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #93 from chowyiyin/branch-v1.2
Branch v1.2
- Loading branch information
Showing
53 changed files
with
2,503 additions
and
233 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
src/main/java/seedu/address/logic/commands/DoNotMergeCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package seedu.address.logic.commands; | ||
|
||
import static java.util.Objects.requireNonNull; | ||
|
||
import java.util.ArrayList; | ||
|
||
import seedu.address.logic.commands.exceptions.DuplicatePersonWithMergeException; | ||
import seedu.address.model.Model; | ||
import seedu.address.model.person.Person; | ||
|
||
/** | ||
* Adds a person to the address book. | ||
*/ | ||
public class DoNotMergeCommand extends Command { | ||
|
||
public static final String COMMAND_WORD = "nmerge"; | ||
|
||
public static final String MESSAGE_SUCCESS = "This profile was not updated : %1$s."; | ||
|
||
private final Person inputPerson; | ||
private Person originalPerson; | ||
private ArrayList<String[]> differentFields = new ArrayList<>(); | ||
|
||
|
||
/** | ||
* Creates an Merge Command to update the original {@code Person} to the new {@code Person} | ||
*/ | ||
public DoNotMergeCommand(Person inputPerson) { | ||
requireNonNull(inputPerson); | ||
this.inputPerson = inputPerson; | ||
} | ||
|
||
@Override | ||
public CommandResult execute(Model model) throws DuplicatePersonWithMergeException { | ||
requireNonNull(model); | ||
StringBuilder prompt = new StringBuilder(); | ||
this.originalPerson = model.getPerson(inputPerson); | ||
return new CommandResult(String.format(MESSAGE_SUCCESS, originalPerson)); | ||
} | ||
|
||
@Override | ||
public boolean equals(Object other) { | ||
return other == this // short circuit if same object | ||
|| (other instanceof DoNotMergeCommand // instanceof handles nulls | ||
&& inputPerson.equals(((DoNotMergeCommand) other).inputPerson)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.