Skip to content

Commit

Permalink
Add Javadocs
Browse files Browse the repository at this point in the history
  • Loading branch information
yyihaoc committed Oct 16, 2024
1 parent 32bfe2b commit 26c2473
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ public FindCommand parse(String args) throws ParseException {
new RoleContainsKeywordsPredicate(roleKeywords));
}

/**
* Returns true if any of the prefixes contains non-empty {@code Optional} values in the given
* {@code ArgumentMultimap}.
*/
public static boolean areSomePrefixesPresent(ArgumentMultimap argumentMultimap, Prefix... prefixes) {
return Stream.of(prefixes).anyMatch(prefix -> argumentMultimap.getValue(prefix).isPresent());
}
Expand Down
16 changes: 0 additions & 16 deletions src/main/java/seedu/address/model/person/Person.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Objects;
import java.util.Set;

Expand All @@ -24,25 +23,12 @@ public class Person {
private final Phone phone;
private final Email email;
private final Telegram telegram;
// private List<Role> roles;

// Data fields
private final Set<Tag> tags = new HashSet<>();

/**
* Every field must be present and not null.
*/
/*
public Person(Name name, Phone phone, Email email, Telegram telegram, List<Role> roles, Set<Tag> tags) {
requireAllNonNull(name, phone, email, telegram, tags);
this.name = name;
this.phone = phone;
this.email = email;
this.telegram = telegram;
this.roles = roles;
this.tags.addAll(tags);
}
*/
public Person(Name name, Phone phone, Email email, Telegram telegram, Set<Tag> tags) {
requireAllNonNull(name, phone, email, telegram, tags);
Expand All @@ -69,8 +55,6 @@ public Telegram getTelegram() {
return telegram;
}

// public List<Role> getRoles() {return roles;}

/**
* Returns an immutable tag set, which throws {@code UnsupportedOperationException}
* if modification is attempted.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
import seedu.address.commons.util.ToStringBuilder;
import seedu.address.model.tag.Tag;

/**
* Tests that a {@code Person}'s {@code Role} matches any of the keywords given.
*/
public class RoleContainsKeywordsPredicate implements Predicate<Person> {
private final List<String> keywords;

Expand All @@ -17,7 +20,6 @@ public RoleContainsKeywordsPredicate(List<String> keywords) {
@Override
public boolean test(Person person) {
return keywords.stream()
// .anyMatch(keyword -> person.getRoles().stream().anyMatch(role -> role.equals(new Role(keyword))));
.anyMatch(keyword -> person.getTags().stream().anyMatch(x -> x.equals(new Tag(keyword))));
}

Expand Down
3 changes: 1 addition & 2 deletions src/main/java/seedu/address/model/tag/Tag.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,8 @@ public boolean equals(Object other) {
}

Tag otherTag = (Tag) other;
// return tagName.equals(otherTag.tagName);
return tagName.equalsIgnoreCase(otherTag.tagName);

return tagName.equalsIgnoreCase(otherTag.tagName);
}

@Override
Expand Down

0 comments on commit 26c2473

Please sign in to comment.