-
Notifications
You must be signed in to change notification settings - Fork 315
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Completed C-Sort, C-DetectDuplicates
- Loading branch information
Showing
22 changed files
with
207 additions
and
38 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
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,46 @@ | ||
package duke.command; | ||
|
||
import duke.exception.DukeException; | ||
import duke.util.Parser; | ||
import duke.util.Ui; | ||
import duke.util.Storage; | ||
import duke.task.TaskList; | ||
import duke.task.Task; | ||
|
||
/** | ||
* Command containing method for finding Tasks in TaskList. | ||
*/ | ||
public class SortCommand extends Command { | ||
private String field; | ||
|
||
/** | ||
* Constructor for SortCommand. | ||
* | ||
* @param field Field to sort tasks by. | ||
*/ | ||
public SortCommand(String field) { | ||
this.field = field; | ||
} | ||
|
||
/** | ||
* Sorts Tasks in TaskList according to the specified field. | ||
* | ||
* @param tasks TaskList to sort Tasks. | ||
* @param ui Ui for printing responses to the console. | ||
* @param storage Storage that stores the modified TaskList. | ||
*/ | ||
public void execute(TaskList tasks, Ui ui, Storage storage) throws DukeException { | ||
tasks.sort(field); | ||
ui.printResponse("Here is the sorted list:\n" | ||
+ tasks.toString() + "\n"); | ||
} | ||
|
||
/** | ||
* Returns boolean to initiate exit of program. | ||
* | ||
* @return False so program does not exit. | ||
*/ | ||
public boolean isExit() { | ||
return false; | ||
} | ||
} |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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
Oops, something went wrong.