forked from nus-cs2103-AY2324S2/tp
-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Filter articles by tag #85
Merged
Ko-Khan
merged 14 commits into
AY2324S2-CS2103T-F12-2:master
from
Ko-Khan:branch-kk-filterArticlesByTag
Mar 30, 2024
+65
−17
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
be1b8ac
Merge branch 'master' into branch-kk-updateDeveloperGuide
Ko-Khan 2758ac1
Merge branch 'branch-kk-updateDeveloperGuide' of
Ko-Khan 91a3705
Merge branch 'branch-kk-updateDeveloperGuide'
Ko-Khan 0cc9c4b
Merge branch 'master' of https://github.com/AY2324S2-CS2103T-F12-2/tp
Ko-Khan 30619e5
Merge branch 'master' of https://github.com/AY2324S2-CS2103T-F12-2/tp
Ko-Khan 62802f9
Merge branch 'master' of https://github.com/AY2324S2-CS2103T-F12-2/tp
Ko-Khan f11736c
Add new predicate
Ko-Khan 965e110
Add filter by tag feature for
Ko-Khan 1c194fa
Remove redundant import
Ko-Khan ac17d7b
Add defensive code
Ko-Khan 89a404b
Remove import statement
Ko-Khan c5c6ad3
Delete unnecessary files
Ko-Khan 02ba69c
Replace prefix tag with article tag
Ko-Khan f434f93
Change boolean variable name
Ko-Khan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
19 changes: 11 additions & 8 deletions
19
...logic/parser/SetArticleCommandParser.java → ...ic/parser/FilterArticleCommandParser.java
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
33 changes: 33 additions & 0 deletions
33
src/main/java/seedu/address/model/article/ArticleMatchesTagPredicate.java
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,33 @@ | ||
package seedu.address.model.article; | ||
|
||
import static java.util.Objects.requireNonNull; | ||
|
||
import java.util.Set; | ||
import java.util.function.Predicate; | ||
|
||
import seedu.address.model.tag.Tag; | ||
|
||
/** | ||
* Checks if article has matching tag | ||
*/ | ||
public class ArticleMatchesTagPredicate implements Predicate<Article> { | ||
private Tag tag; | ||
public ArticleMatchesTagPredicate(Tag tag) { | ||
this.tag = tag; | ||
} | ||
|
||
@Override | ||
public boolean test(Article article) { | ||
requireNonNull(article); | ||
Set<Tag> others = article.getTags(); | ||
boolean isMatch = false; | ||
requireNonNull(tag); | ||
for (Tag other : others) { | ||
requireNonNull(other); | ||
if (other.equals(tag)) { | ||
isMatch = true; | ||
} | ||
} | ||
return isMatch; | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM