-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
…dules B-ViewSchedules
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#Wed Sep 18 16:29:59 SGT 2019 | ||
gradle.version=5.5.1 |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +0,0 @@ | ||
T|0|read book | ||
D|0|return book |tmr | ||
E|0|meeting |2019-09-09 | ||
[P][✘] pain (from: TODO to: TODO | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package duke.command; | ||
|
||
import duke.storage.Storage; | ||
import duke.task.Task; | ||
import duke.task.TaskList; | ||
import duke.ui.Ui; | ||
|
||
import java.time.LocalDate; | ||
import java.util.Date; | ||
|
||
|
||
/** | ||
* Represents a specific {@link Command} used to find a String occurring in the {@link TaskList} | ||
*/ | ||
public class ViewCommand extends Command { | ||
|
||
private final Date Date = new Date(); | ||
private Date toView; | ||
|
||
public ViewCommand(Date toView) { | ||
this.toView = toView; | ||
} | ||
|
||
@Override | ||
public void execute(TaskList taskList, Ui ui, Storage storage) { | ||
StringBuilder sb = new StringBuilder(); | ||
int i = 1; | ||
try { | ||
for (Task task : taskList.getAllTasks()) { | ||
//task.setNewDate(); | ||
if ((task.getCurrentDate()).equals(toView)) { | ||
//needs work on this part. comparing of time use Date always takes into account time 0000 | ||
sb.append("\t ").append(i++).append(".").append(task.toString()); | ||
sb.append(System.lineSeparator()); | ||
} | ||
} | ||
if (sb.length() == 0) { | ||
System.out.println("No matching date found! "); | ||
} else | ||
System.out.println("\t Here are the tasks in the requested date:"); | ||
sb.setLength(sb.length() - 1);// to remove the last new line | ||
System.out.println(sb.toString()); | ||
}catch(Exception e) { | ||
|
||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package duke.task; | ||
|
||
import duke.parser.Parser; | ||
|
||
import java.text.SimpleDateFormat; | ||
import java.time.LocalDate; | ||
import java.time.ZoneId; | ||
import java.util.Date; | ||
|
||
//import static duke.task.Task.getDate; | ||
|
||
public class ViewSchedules extends TaskList | ||
{ | ||
private Date when; | ||
public ViewSchedules(String when) { | ||
this.when = Parser.getDate(when); | ||
} | ||
|
||
public Date getCurrentDate() { | ||
return when; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<module type="JAVA_MODULE" version="4"> | ||
<component name="NewModuleRootManager" inherit-compiler-output="true"> | ||
<exclude-output /> | ||
<content url="file://$MODULE_DIR$"> | ||
<sourceFolder url="file://$MODULE_DIR$/java" isTestSource="true" /> | ||
</content> | ||
<orderEntry type="inheritedJdk" /> | ||
<orderEntry type="sourceFolder" forTests="false" /> | ||
<orderEntry type="module" module-name="main" /> | ||
<orderEntry type="module-library" scope="TEST"> | ||
<library name="JUnit4"> | ||
<CLASSES> | ||
<root url="jar://$MAVEN_REPOSITORY$/junit/junit/4.12/junit-4.12.jar!/" /> | ||
<root url="jar://$MAVEN_REPOSITORY$/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar!/" /> | ||
</CLASSES> | ||
<JAVADOC /> | ||
<SOURCES /> | ||
</library> | ||
</orderEntry> | ||
</component> | ||
</module> |