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.
There is a lack of any features to categorize tasks in the list to make it easier to see what the task is about Adding of tag a tag feature would help to solve this problem To do so adding the function to be able to tag tasks with additional details would make it easier to organize and categorize tasks.
- Loading branch information
1 parent
b72b77c
commit 83f0c53
Showing
9 changed files
with
168 additions
and
15 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,36 @@ | ||
package van; | ||
|
||
import java.util.ArrayList; | ||
|
||
public class Tag { | ||
private ArrayList<String> tags; | ||
|
||
public Tag() { | ||
tags = new ArrayList<>(); | ||
} | ||
|
||
public void add(String newTag) { | ||
if (!(tags.contains(newTag))) { | ||
tags.add(newTag); | ||
} | ||
} | ||
|
||
public void delete(String newTag) { | ||
int index = tags.indexOf(newTag); | ||
if (index != -1) { | ||
tags.remove(index); | ||
} | ||
} | ||
|
||
public ArrayList<String> getTags() { | ||
return tags; | ||
} | ||
|
||
public String toString() { | ||
String output = ""; | ||
for (int i = 0; i < tags.size(); i++) { | ||
output = output + "#" + tags.get(i) + " "; | ||
} | ||
return output; | ||
} | ||
} |
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,30 @@ | ||
package van; | ||
|
||
public class TagCommand implements Command { | ||
private boolean isAddTag; | ||
private String tag; | ||
private int index; | ||
|
||
public TagCommand(boolean isAddTag,int index, String tag) { | ||
this.isAddTag = isAddTag; | ||
this.index = index; | ||
this.tag = tag; | ||
} | ||
|
||
public boolean executeCommand(Ui ui, TaskList taskList, Storage storage) { | ||
try { | ||
if (index > taskList.getTaskCount()) { | ||
throw new VanException("Task number out of range"); | ||
} | ||
if (isAddTag) { | ||
taskList.addTag(index, tag); | ||
} else { | ||
taskList.deleteTag(index, tag); | ||
} | ||
ui.tagMessage(isAddTag); | ||
} catch (VanException ex) { | ||
System.out.println(ex); | ||
} | ||
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
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