Skip to content

Commit

Permalink
Rectify references to Tag in Author and Source parser methods
Browse files Browse the repository at this point in the history
  • Loading branch information
H4mes committed Mar 28, 2024
1 parent 44c843d commit 8246758
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions src/main/java/seedu/address/logic/parser/ParserUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -148,14 +148,14 @@ public static String parseTitle(String title) throws ParseException {
public static Author parseAuthor(String author) throws ParseException {
requireNonNull(author);
String trimmedAuthor = author.trim();
if (!Tag.isValidTagName(trimmedAuthor)) {
throw new ParseException(Tag.MESSAGE_CONSTRAINTS);
if (!Author.isValidAuthorName(trimmedAuthor)) {
throw new ParseException(Author.MESSAGE_CONSTRAINTS);
}
return new Author(trimmedAuthor);
}

/**
* Parses a {@code List<String> authors} into a {@code String[]}.
* Parses a {@code List<String> authors} into a {@code Set<Author>}.
*/
public static Set<Author> parseAuthors(Collection<String> authors) throws ParseException {
requireNonNull(authors);
Expand Down Expand Up @@ -191,14 +191,14 @@ public static LocalDateTime parsePublicationDate(String publicationDate) throws
public static Source parseSource(String source) throws ParseException {
requireNonNull(source);
String trimmedSource = source.trim();
if (!Tag.isValidTagName(trimmedSource)) {
throw new ParseException(Tag.MESSAGE_CONSTRAINTS);
if (!Source.isValidSourceName(trimmedSource)) {
throw new ParseException(Source.MESSAGE_CONSTRAINTS);
}
return new Source(trimmedSource);
}

/**
* Parses a {@code List<String> sources} into a {@code String[]}.
* Parses a {@code List<String> sources} into a {@code Set<Source>}.
*/
public static Set<Source> parseSources(Collection<String> sources) throws ParseException {
requireNonNull(sources);
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/seedu/address/model/article/Article.java
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,11 @@ public boolean isSameArticle(Article otherArticle) {
return true;

/*
* Same authors may have many drafts of same article. If it is not draft and has same title and authors,
* If it is not draft and has same title as another article,
* consider it as same article
*/
} else if (otherArticle.getStatus() != Status.DRAFT && this.getStatus() != Status.DRAFT
&& otherArticle.getTitle().equals(this.title) && otherArticle.getAuthors() == this.authors) {
&& otherArticle.getTitle().equals(this.title)) {
return true;
} else {
return false;
Expand Down

0 comments on commit 8246758

Please sign in to comment.