forked from nus-cs2103-AY2122S2/ip
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3927d4e
commit 227f6b5
Showing
11 changed files
with
115 additions
and
23 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
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,2 +1,52 @@ | ||
package duke.command;public class ScheduleCommand { | ||
package duke.command; | ||
|
||
import java.time.LocalDate; | ||
|
||
import duke.functionality.TaskList; | ||
|
||
/** | ||
* Represents the schedule command. A <code>ScheduleCommand</code> object corresponds to finding similar tasks | ||
* in the taskList of TaskList class. | ||
*/ | ||
public class ScheduleCommand extends Command { | ||
private LocalDate date; | ||
|
||
/** | ||
* Constructor of FindCommand. | ||
* @param date date used to find similar tasks in taskList of TaskList class. | ||
*/ | ||
public ScheduleCommand(LocalDate date) { | ||
super(null); | ||
this.date = date; | ||
} | ||
|
||
/** | ||
* Returns a string which contains all the task after the execution of findSameSchedule in the TaskList class. | ||
* @param tasks an object of TaskList, used to access public methods in TaskList class. | ||
* @return crafted message after calling findSameSchedule in the TaskList class. | ||
*/ | ||
@Override | ||
public String execute(TaskList tasks) { | ||
TaskList newTaskList = tasks.findSameSchedule(this.date); | ||
String message = "Here is your Schedule for " + this.date + "\n"; | ||
int counter = 1; | ||
for (int i = 0; i < newTaskList.getListSize(); i++) { | ||
String output = counter + "." + newTaskList.getTask(i); | ||
counter++; | ||
message += output + "\n"; | ||
} | ||
if (counter == 1) { | ||
message = "You have no Schedule on " + this.date + "\n"; | ||
} | ||
return message; | ||
} | ||
|
||
/** | ||
* Returns false as the Command is not an ExitCommand. | ||
* @return false. | ||
*/ | ||
@Override | ||
public boolean isExit() { | ||
return false; | ||
} | ||
} |
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