forked from se-edu/duke
-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Give users a way to find a task by searching for a keyword. Also, cha…
…nge command to be abstract.
- Loading branch information
1 parent
4116a14
commit 0749817
Showing
12 changed files
with
126 additions
and
44 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package duke.command; | ||
|
||
import duke.common.DukeException; | ||
import duke.storage.Storage; | ||
import duke.taskList.TaskList; | ||
import duke.taskList.task.Task; | ||
import duke.ui.Ui; | ||
|
||
import java.io.IOException; | ||
import java.util.ArrayList; | ||
|
||
public class FindCommand extends Command{ | ||
private static String findString; | ||
private static ArrayList<Integer> findCount; | ||
|
||
public FindCommand (String findString) { | ||
this.findString = findString; | ||
findCount = new ArrayList<>(); | ||
} | ||
|
||
public void execute (TaskList tasks, Ui ui, Storage storage) throws IOException, DukeException { | ||
for(int i = 0; i<tasks.size(); i++) { | ||
if(tasks.getATask(i).getDescription().contains(findString)) { | ||
findCount.add(i); | ||
} | ||
} | ||
ui.showFindTask(tasks,findCount); | ||
} | ||
} |
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
T | 0 | eat | ||
T | 0 | read book | ||
D | 1 | cs2113 | Tuesday | ||
E | 0 | project meeting | Mon 2-4pm | ||
D | 0 | book review | Friday |
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 |
---|---|---|
@@ -1,15 +1,21 @@ | ||
done | ||
list | ||
todo eat | ||
todo read book | ||
todo sleep | ||
todo | ||
heyhey | ||
deadline cs2113 /by Tuesday | ||
event project meeting /at Mon 2-4pm | ||
deadline book review /by Friday | ||
event | ||
find book | ||
find | ||
find exam | ||
done 2 | ||
done 3 | ||
done 10 | ||
list | ||
delete 2 | ||
delete | ||
list | ||
bye |