From 6e61aaf27462b1716569550e11f6074cacb628d6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Tue, 4 Nov 2014 20:22:40 +0100 Subject: [PATCH] Remove some unused methods. --- .../sone/database/PostReplyStore.java | 21 ------ .../net/pterodactylus/sone/database/PostStore.java | 21 ------ .../sone/database/memory/MemoryDatabase.java | 86 ---------------------- 3 files changed, 128 deletions(-) diff --git a/src/main/java/net/pterodactylus/sone/database/PostReplyStore.java b/src/main/java/net/pterodactylus/sone/database/PostReplyStore.java index a3cefb3..30268b8 100644 --- a/src/main/java/net/pterodactylus/sone/database/PostReplyStore.java +++ b/src/main/java/net/pterodactylus/sone/database/PostReplyStore.java @@ -38,19 +38,6 @@ public interface PostReplyStore { public void storePostReply(PostReply postReply); /** - * Stores the given post replies as exclusive collection of post replies for - * the given Sone. This will remove all other post replies from this Sone! - * - * @param sone - * The Sone to store all post replies for - * @param postReplies - * The post replies of the Sone - * @throws IllegalArgumentException - * if one of the replies does not belong to the given Sone - */ - public void storePostReplies(Sone sone, Collection postReplies) throws IllegalArgumentException; - - /** * Removes the given post reply from this store. * * @param postReply @@ -58,12 +45,4 @@ public interface PostReplyStore { */ public void removePostReply(PostReply postReply); - /** - * Removes all post replies of the given Sone. - * - * @param sone - * The Sone to remove all post replies for - */ - public void removePostReplies(Sone sone); - } diff --git a/src/main/java/net/pterodactylus/sone/database/PostStore.java b/src/main/java/net/pterodactylus/sone/database/PostStore.java index 9c2ca42..402a647 100644 --- a/src/main/java/net/pterodactylus/sone/database/PostStore.java +++ b/src/main/java/net/pterodactylus/sone/database/PostStore.java @@ -45,25 +45,4 @@ public interface PostStore { */ public void removePost(Post post); - /** - * Stores the given posts as all posts of a single {@link Sone}. This method - * will removed all other posts from the Sone! - * - * @param sone - * The Sone to store the posts for - * @param posts - * The posts to store - * @throws IllegalArgumentException - * if posts do not all belong to the same Sone - */ - public void storePosts(Sone sone, Collection posts) throws IllegalArgumentException; - - /** - * Removes all posts of the given {@link Sone} - * - * @param sone - * The Sone to remove all posts for - */ - public void removePosts(Sone sone); - } diff --git a/src/main/java/net/pterodactylus/sone/database/memory/MemoryDatabase.java b/src/main/java/net/pterodactylus/sone/database/memory/MemoryDatabase.java index 0f795eb..eb0d20a 100644 --- a/src/main/java/net/pterodactylus/sone/database/memory/MemoryDatabase.java +++ b/src/main/java/net/pterodactylus/sone/database/memory/MemoryDatabase.java @@ -357,51 +357,6 @@ public class MemoryDatabase extends AbstractService implements Database { } } - /** {@inheritDocs} */ - @Override - public void storePosts(Sone sone, Collection posts) throws IllegalArgumentException { - checkNotNull(sone, "sone must not be null"); - /* verify that all posts are from the same Sone. */ - for (Post post : posts) { - if (!sone.equals(post.getSone())) { - throw new IllegalArgumentException(String.format("Post from different Sone found: %s", post)); - } - } - - lock.writeLock().lock(); - try { - /* remove all posts by the Sone. */ - Collection oldPosts = getPostsFrom(sone.getId()); - for (Post post : oldPosts) { - allPosts.remove(post.getId()); - } - - /* add new posts. */ - getPostsFrom(sone.getId()).addAll(posts); - for (Post post : posts) { - allPosts.put(post.getId(), post); - } - } finally { - lock.writeLock().unlock(); - } - } - - /** {@inheritDocs} */ - @Override - public void removePosts(Sone sone) { - checkNotNull(sone, "sone must not be null"); - lock.writeLock().lock(); - try { - /* remove all posts by the Sone. */ - getPostsFrom(sone.getId()).clear(); - for (Post post : sone.getPosts()) { - allPosts.remove(post.getId()); - } - } finally { - lock.writeLock().unlock(); - } - } - // // POSTREPLYPROVIDER METHODS // @@ -461,32 +416,6 @@ public class MemoryDatabase extends AbstractService implements Database { /** {@inheritDocs} */ @Override - public void storePostReplies(Sone sone, Collection postReplies) { - checkNotNull(sone, "sone must not be null"); - /* verify that all posts are from the same Sone. */ - for (PostReply postReply : postReplies) { - if (!sone.equals(postReply.getSone())) { - throw new IllegalArgumentException(String.format("PostReply from different Sone found: %s", postReply)); - } - } - - lock.writeLock().lock(); - try { - /* remove all post replies of the Sone. */ - for (PostReply postReply : getRepliesFrom(sone.getId())) { - removePostReply(postReply); - } - for (PostReply postReply : postReplies) { - allPostReplies.put(postReply.getId(), postReply); - sonePostReplies.put(postReply.getSone().getId(), postReply); - } - } finally { - lock.writeLock().unlock(); - } - } - - /** {@inheritDocs} */ - @Override public void removePostReply(PostReply postReply) { lock.writeLock().lock(); try { @@ -496,21 +425,6 @@ public class MemoryDatabase extends AbstractService implements Database { } } - /** {@inheritDocs} */ - @Override - public void removePostReplies(Sone sone) { - checkNotNull(sone, "sone must not be null"); - - lock.writeLock().lock(); - try { - for (PostReply postReply : sone.getReplies()) { - removePostReply(postReply); - } - } finally { - lock.writeLock().unlock(); - } - } - // // ALBUMPROVDER METHODS // -- 2.7.4