33import static java .util .Objects .requireNonNull ;
44import static seedu .address .logic .parser .CliSyntax .PREFIX_DESCRIPTION ;
55import static seedu .address .logic .parser .CliSyntax .PREFIX_NAME ;
6+ import static seedu .address .logic .parser .CliSyntax .PREFIX_PRIORITY ;
67import static seedu .address .logic .parser .CliSyntax .PREFIX_STATE ;
78import static seedu .address .logic .parser .CliSyntax .PREFIX_TAG ;
89import static seedu .address .model .Model .PREDICATE_SHOW_ALL_BUGS ;
2122import seedu .address .model .bug .Bug ;
2223import seedu .address .model .bug .Description ;
2324import seedu .address .model .bug .Name ;
25+ import seedu .address .model .bug .Priority ;
2426import seedu .address .model .bug .State ;
2527import seedu .address .model .tag .Tag ;
2628
@@ -39,6 +41,7 @@ public class EditCommand extends Command {
3941 + "[" + PREFIX_NAME + "NAME] "
4042 + "[" + PREFIX_STATE + "STATE] "
4143 + "[" + PREFIX_DESCRIPTION + "DESCRIPTION] "
44+ + "[" + PREFIX_PRIORITY + "PRIORITY] "
4245 + "[" + PREFIX_TAG + "TAG]...\n "
4346 + "Example: " + COMMAND_WORD + " 1 "
4447 + PREFIX_STATE + "johndoe@example.com" ;
@@ -94,8 +97,9 @@ private static Bug createEditedBug(Bug bugToEdit, EditBugDescriptor editBugDescr
9497 State updatedState = editBugDescriptor .getState ().orElse (bugToEdit .getState ());
9598 Description updatedDescription = editBugDescriptor .getDescription ().orElse (bugToEdit .getDescription ());
9699 Set <Tag > updatedTags = editBugDescriptor .getTags ().orElse (bugToEdit .getTags ());
100+ Priority updatedPriority = editBugDescriptor .getPriority ().orElse (bugToEdit .getPriority ());
97101
98- return new Bug (updatedName , updatedState , updatedDescription , updatedTags );
102+ return new Bug (updatedName , updatedState , updatedDescription , updatedTags , updatedPriority );
99103 }
100104
101105 @ Override
@@ -125,6 +129,7 @@ public static class EditBugDescriptor {
125129 private State state ;
126130 private Description description ;
127131 private Set <Tag > tags ;
132+ private Priority priority ;
128133
129134 public EditBugDescriptor () {}
130135
@@ -137,13 +142,14 @@ public EditBugDescriptor(EditBugDescriptor toCopy) {
137142 setState (toCopy .state );
138143 setDescription (toCopy .description );
139144 setTags (toCopy .tags );
145+ setPriority (toCopy .priority );
140146 }
141147
142148 /**
143149 * Returns true if at least one field is edited.
144150 */
145151 public boolean isAnyFieldEdited () {
146- return CollectionUtil .isAnyNonNull (name , state , description , tags );
152+ return CollectionUtil .isAnyNonNull (name , state , description , tags , priority );
147153 }
148154
149155 public void setName (Name name ) {
@@ -170,6 +176,14 @@ public Optional<Description> getDescription() {
170176 return Optional .ofNullable (description );
171177 }
172178
179+ public void setPriority (Priority priority ) {
180+ this .priority = priority ;
181+ }
182+
183+ public Optional <Priority > getPriority () {
184+ return Optional .ofNullable (priority );
185+ }
186+
173187 /**
174188 * Sets {@code tags} to this object's {@code tags}.
175189 * A defensive copy of {@code tags} is used internally.
@@ -205,6 +219,7 @@ public boolean equals(Object other) {
205219 return getName ().equals (e .getName ())
206220 && getState ().equals (e .getState ())
207221 && getDescription ().equals (e .getDescription ())
222+ && getPriority ().equals (e .getPriority ())
208223 && getTags ().equals (e .getTags ());
209224 }
210225 }
0 commit comments