From d36aa88de57f1492db61e3f6cb4daeeceab1904e Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Thu, 9 Jun 2016 07:17:39 +0200 Subject: [PATCH] Fix documentation and annotation --- .../sone/notify/ListNotificationFilter.java | 28 ++++++++++------------ 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/src/main/java/net/pterodactylus/sone/notify/ListNotificationFilter.java b/src/main/java/net/pterodactylus/sone/notify/ListNotificationFilter.java index 77dc2ea..f3c9305 100644 --- a/src/main/java/net/pterodactylus/sone/notify/ListNotificationFilter.java +++ b/src/main/java/net/pterodactylus/sone/notify/ListNotificationFilter.java @@ -23,6 +23,7 @@ import java.util.ArrayList; import java.util.Collection; import java.util.List; import javax.annotation.Nonnull; +import javax.annotation.Nullable; import javax.inject.Inject; import javax.inject.Singleton; @@ -109,32 +110,27 @@ public class ListNotificationFilter { } /** - * Filters the new posts of the given notification. If {@code currentSone} - * is {@code null} and {@code soneRequired} is {@code true}, {@code null} is - * returned and the notification is subsequently removed. Otherwise only - * posts that are posted by friend Sones of the given Sone are retained; all - * other posts are removed. + * Filters the posts of the given notification. * - * @param newPostNotification - * The new-post notification + * @param postNotification + * The post notification * @param currentSone * The current Sone, or {@code null} if not logged in - * @return The filtered new-post notification, or {@code null} if the - * notification should be removed + * @return The filtered post notification, or {@link Optional#absent()} if the notification should be removed */ @Nonnull - private Optional> filterNewPostNotification(@Nonnull ListNotification newPostNotification, - @Nonnull Sone currentSone) { - List newPosts = from(newPostNotification.getElements()).filter(postVisibilityFilter.isVisible(currentSone)).toList(); + private Optional> filterNewPostNotification(@Nonnull ListNotification postNotification, + @Nullable Sone currentSone) { + List newPosts = from(postNotification.getElements()).filter(postVisibilityFilter.isVisible(currentSone)).toList(); if (newPosts.isEmpty()) { return Optional.absent(); } - if (newPosts.size() == newPostNotification.getElements().size()) { - return Optional.of(newPostNotification); + if (newPosts.size() == postNotification.getElements().size()) { + return Optional.of(postNotification); } - ListNotification filteredNotification = new ListNotification(newPostNotification); + ListNotification filteredNotification = new ListNotification(postNotification); filteredNotification.setElements(newPosts); - filteredNotification.setLastUpdateTime(newPostNotification.getLastUpdatedTime()); + filteredNotification.setLastUpdateTime(postNotification.getLastUpdatedTime()); return Optional.of(filteredNotification); } -- 2.7.4