Added matches().

This commit is contained in:
Erik C. Thauvin 2020-03-29 00:42:02 -07:00
parent 4aeb17ecef
commit 02fae4d8e4

View file

@ -36,6 +36,7 @@ import com.rometools.rome.feed.synd.SyndCategory;
import com.rometools.rome.feed.synd.SyndCategoryImpl;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import net.thauvin.erik.mobibot.Constants;
import org.apache.commons.lang3.StringUtils;
import java.io.Serializable;
import java.util.Calendar;
@ -161,16 +162,6 @@ public class EntryLink implements Serializable {
return channel;
}
/**
* Sets the channel.
*
* @param channel The channel.
*/
@SuppressWarnings("UnusedDeclaration")
public final void setChannel(final String channel) {
this.channel = channel;
}
/**
* Returns a comment.
*
@ -217,15 +208,6 @@ public class EntryLink implements Serializable {
return link;
}
/**
* Sets the comment's link.
*
* @param link The new link.
*/
public final void setLink(final String link) {
this.link = link;
}
/**
* Returns the comment's author login.
*
@ -235,16 +217,6 @@ public class EntryLink implements Serializable {
return login;
}
/**
* Sets the comment's author login.
*
* @param login The new login.
*/
@SuppressWarnings("UnusedDeclaration")
public final void setLogin(final String login) {
this.login = login;
}
/**
* Returns the comment's author nickname.
*
@ -254,15 +226,6 @@ public class EntryLink implements Serializable {
return nick;
}
/**
* Sets the comment's author nickname.
*
* @param nick The new nickname.
*/
public final void setNick(final String nick) {
this.nick = nick;
}
/**
* Returns the tags formatted for pinboard.in
*
@ -288,6 +251,96 @@ public class EntryLink implements Serializable {
return tags;
}
/**
* Returns the comment's title.
*
* @return The title.
*/
public final String getTitle() {
return title;
}
/**
* Returns true if the entry has comments.
*
* @return true if there are comments, false otherwise.
*/
public final boolean hasComments() {
return !comments.isEmpty();
}
/**
* Returns true if the entry has tags.
*
* @return true if there are tags, false otherwise.
*/
public final boolean hasTags() {
return !tags.isEmpty();
}
/**
* Returns true if a string is contained in the link, title, or nick.
*
* @param match The string to match.
* @return {@code true} if matched, {@code false} otherwise.
*/
public Boolean matches(final String match) {
return (StringUtils.containsIgnoreCase(link, match)
|| StringUtils.containsIgnoreCase(title, match)
|| StringUtils.containsIgnoreCase(nick, match));
}
/**
* Sets the channel.
*
* @param channel The channel.
*/
@SuppressWarnings("UnusedDeclaration")
public final void setChannel(final String channel) {
this.channel = channel;
}
/**
* /** Sets a comment.
*
* @param index The comment's index.
* @param comment The actual comment.
* @param nick The nickname of the author of the comment.
*/
public final void setComment(final int index, final String comment, final String nick) {
if (index < comments.size()) {
comments.set(index, new EntryComment(comment, nick));
}
}
/**
* Sets the comment's link.
*
* @param link The new link.
*/
public final void setLink(final String link) {
this.link = link;
}
/**
* Sets the comment's author login.
*
* @param login The new login.
*/
@SuppressWarnings("UnusedDeclaration")
public final void setLogin(final String login) {
this.login = login;
}
/**
* Sets the comment's author nickname.
*
* @param nick The new nickname.
*/
public final void setNick(final String nick) {
this.nick = nick;
}
/**
* Sets the tags.
*
@ -342,15 +395,6 @@ public class EntryLink implements Serializable {
this.tags.addAll(tags);
}
/**
* Returns the comment's title.
*
* @return The title.
*/
public final String getTitle() {
return title;
}
/**
* Sets the comment's title.
*
@ -360,37 +404,6 @@ public class EntryLink implements Serializable {
this.title = title;
}
/**
* Returns true if the entry has comments.
*
* @return true if there are comments, false otherwise.
*/
public final boolean hasComments() {
return (!comments.isEmpty());
}
/**
* Returns true if the entry has tags.
*
* @return true if there are tags, false otherwise.
*/
public final boolean hasTags() {
return (!tags.isEmpty());
}
/**
* /** Sets a comment.
*
* @param index The comment's index.
* @param comment The actual comment.
* @param nick The nickname of the author of the comment.
*/
public final void setComment(final int index, final String comment, final String nick) {
if (index < comments.size()) {
comments.set(index, new EntryComment(comment, nick));
}
}
/**
* Returns a string representation of the object.
*