Skip to content

Commit

Permalink
Merge pull request AY1920S1-CS2113-T14-2#24 from x3chillax/B-ViewSche…
Browse files Browse the repository at this point in the history
…dules

B-ViewSchedules
  • Loading branch information
x3chillax authored Sep 18, 2019
2 parents 2c44d1e + 42d4245 commit dfdd207
Show file tree
Hide file tree
Showing 50 changed files with 229 additions and 19 deletions.
Binary file not shown.
Binary file not shown.
Binary file added .gradle/5.5.1/fileChanges/last-build.bin
Binary file not shown.
Binary file added .gradle/5.5.1/fileHashes/fileHashes.lock
Binary file not shown.
Empty file added .gradle/5.5.1/gc.properties
Empty file.
Binary file added .gradle/buildOutputCleanup/buildOutputCleanup.lock
Binary file not shown.
2 changes: 2 additions & 0 deletions .gradle/buildOutputCleanup/cache.properties
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
Empty file added .gradle/vcs-1/gc.properties
Empty file.
52 changes: 52 additions & 0 deletions .idea/$PRODUCT_WORKSPACE_FILE$

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions .idea/libraries/gradle_wrapper.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions .idea/modules/CS2113Team.main.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions data/tasks.txt
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
Binary file added out/production/main/duke/Duke.class
Binary file not shown.
Binary file added out/production/main/duke/command/AddCommand.class
Binary file not shown.
Binary file added out/production/main/duke/command/Command.class
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added out/production/main/duke/command/ExitCommand.class
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added out/production/main/duke/parser/Parser.class
Binary file not shown.
Binary file added out/production/main/duke/storage/Storage.class
Binary file not shown.
Binary file added out/production/main/duke/task/Deadline.class
Binary file not shown.
Binary file added out/production/main/duke/task/Event.class
Binary file not shown.
Binary file added out/production/main/duke/task/Task.class
Binary file not shown.
Binary file added out/production/main/duke/task/TaskList.class
Binary file not shown.
Binary file added out/production/main/duke/task/Todo.class
Binary file not shown.
Binary file added out/production/main/duke/ui/Ui.class
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.
12 changes: 6 additions & 6 deletions README.md → src/main/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@

Duke Increment | Tutorial
---------------|---------------
`A-Gradle` | [Gradle Tutorial](tutorials/gradleTutorial.md)
`A-TextUiTesting` | [Text UI Testing Tutorial](tutorials/textUiTestingTutorial.md)
`A-Gradle` | [Gradle Tutorial](../../tutorials/gradleTutorial.md)
`A-TextUiTesting` | [Text UI Testing Tutorial](../../tutorials/textUiTestingTutorial.md)
`Level-10` | JavaFX tutorials:<br>→ [Part 1: Introduction to JavaFX][fx1]<br>→ [Part 2: Creating a GUI for Duke][fx2]<br>→ [Part 3: Interacting with the user][fx3]<br>→ [Part 4: Introduction to FXML][fx4]

[fx1]: <tutorials/javaFxTutorialPart1.md>
[fx2]: <tutorials/javaFxTutorialPart2.md>
[fx3]: <tutorials/javaFxTutorialPart3.md>
[fx4]: <tutorials/javaFxTutorialPart4.md>
[fx1]: <../../tutorials/javaFxTutorialPart1.md>
[fx2]: <../../tutorials/javaFxTutorialPart2.md>
[fx3]: <../../tutorials/javaFxTutorialPart3.md>
[fx4]: <../../tutorials/javaFxTutorialPart4.md>

# Feedback, Bug Reports

Expand Down
File renamed without changes.
0 gradlew → src/main/gradlew
100755 → 100644
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/main/java/duke/command/FindCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ public void execute(TaskList taskList, Ui ui, Storage storage) {
sb.setLength(sb.length() - 1);// to remove the last new line
System.out.println(sb.toString());
}
}
}
47 changes: 47 additions & 0 deletions src/main/java/duke/command/ViewCommand.java
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) {

}
}
}
13 changes: 9 additions & 4 deletions src/main/java/duke/parser/Parser.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,16 +71,22 @@ public static Command parse(String fullCommand) throws DukeException {
int taskNb = Integer.parseInt(splitted[1]);
return new DeleteCommand(taskNb - 1);
} else throw new DukeException("Need a task number after done!");

case "snooze":
if ((splitted.length == 1) || splitted[1].isBlank())
throw new DukeException("The description of a snooze cannot be empty.");
String[] getUntil = splitted[1].split("/until ", 2);
if (getUntil.length < 2)
throw new DukeException("The description of a snooze must contain /until date!");
//return new Snooze(getUntil[0], getUntil[1]);
case "view":
if ((splitted.length == 1) || splitted[1].isBlank()) {
throw new DukeException("The description of a view must contain date!");
}
else{
Date splittedDate = Parser.getDate(splitted[1]);
return new ViewCommand(splittedDate);
}
return new Snooze(getUntil[0], getUntil[1]);


case "period":
if ((splitted.length == 1) || splitted[1].isEmpty())
throw new DukeException("The description of a period cannot be empty.");
Expand All @@ -96,7 +102,6 @@ public static Command parse(String fullCommand) throws DukeException {
catch(Exception e){
throw new DukeException("NO");
}

default:
throw new DukeException("I'm sorry, but I don't know what that means :-(");
}
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/duke/task/Deadline.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public Date getDate() {
* @return String used to print the {@link Task } in the text file
*/
public String printInFile() {
return this.isDone() ? "D|1|" + this.getDescription() + "|" + Parser.getDateString(date, by) : "D|0|" + this.getDescription() + "|" + Parser.getDateString(date, by);
//return this.isDone() ? "D|1|" + this.getDescription() + "|" + Parser.getDateString(date, by) : "D|0|" + this.getDescription() + "|" + Parser.getDateString(date, by);
return this.isDone() ? "D|1|" + this.getDescription() + "|" + by : "D|0|" + this.getDescription() + "|" + by;
}
}
5 changes: 2 additions & 3 deletions src/main/java/duke/task/Event.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,11 @@ public Date getCurrentDate() {
public String toString() {
return "[E]" + super.toString() + "(at: " + Parser.getDateString(date, at) + ")";
}
/**
/**
* Returns the String representation of the {@link Event} in format compatible to be easily read and written in a text file on the hard disc
* @return String used to print the {@link Task } in the text file
*/
public String printInFile() {
return this.isDone() ? "E|1|" + getDescription() + "|" + Parser.getDateString(date, at) : "E|0|" + this.getDescription() + "|" + Parser.getDateString(date, at);
return this.isDone() ? "E|1|" + getDescription() + "|" + at : "E|0|" + this.getDescription() + "|" + at;
}

}
1 change: 1 addition & 0 deletions src/main/java/duke/task/Task.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public String getDescription() {
return description;
}


/**
* Used to mark the {@link Task} as finished
*/
Expand Down
22 changes: 22 additions & 0 deletions src/main/java/duke/task/ViewSchedules.java
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;
}
}
File renamed without changes.
22 changes: 22 additions & 0 deletions src/test/test.iml
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>

0 comments on commit dfdd207

Please sign in to comment.