X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fdatabase%2Fmemory%2FMemoryPost.java;h=2834951d26eea5fa58cc0fe9f002647b0afd2d8f;hp=22fa7e6be5edcd2b2914b3d9f3fad3628a1fab56;hb=ed19f10e7931fb0b09c042c6070e37dffb23ceac;hpb=34a6a72ca76ae5e8ea3d02160b4163baa9912ceb diff --git a/src/main/java/net/pterodactylus/sone/database/memory/MemoryPost.java b/src/main/java/net/pterodactylus/sone/database/memory/MemoryPost.java index 22fa7e6..2834951 100644 --- a/src/main/java/net/pterodactylus/sone/database/memory/MemoryPost.java +++ b/src/main/java/net/pterodactylus/sone/database/memory/MemoryPost.java @@ -21,7 +21,6 @@ import java.util.UUID; import net.pterodactylus.sone.data.Post; import net.pterodactylus.sone.data.Sone; -import net.pterodactylus.sone.database.SoneProvider; import com.google.common.base.Optional; @@ -34,10 +33,7 @@ import com.google.common.base.Optional; class MemoryPost implements Post { /** The post database. */ - private final MemoryDatabase postDatabase; - - /** The Sone provider. */ - private final SoneProvider soneProvider; + private final MemoryDatabase memoryDatabase; /** The GUID of the post. */ private final UUID id; @@ -57,24 +53,21 @@ class MemoryPost implements Post { /** * Creates a new post. * - * @param postDatabase - * The post database - * @param soneProvider - * The Sone provider + * @param memoryDatabase + * The database * @param id - * The ID of the post + * The ID of the post * @param soneId - * The ID of the Sone this post belongs to + * The ID of the Sone this post belongs to * @param recipientId - * The ID of the recipient of the post + * The ID of the recipient of the post * @param time - * The time of the post (in milliseconds since Jan 1, 1970 UTC) + * The time of the post (in milliseconds since Jan 1, 1970 UTC) * @param text - * The text of the post + * The text of the post */ - public MemoryPost(MemoryDatabase postDatabase, SoneProvider soneProvider, String id, String soneId, String recipientId, long time, String text) { - this.postDatabase = postDatabase; - this.soneProvider = soneProvider; + public MemoryPost(MemoryDatabase memoryDatabase, String id, String soneId, String recipientId, long time, String text) { + this.memoryDatabase = memoryDatabase; this.id = UUID.fromString(id); this.soneId = soneId; this.recipientId = recipientId; @@ -86,68 +79,52 @@ class MemoryPost implements Post { // ACCESSORS // - /** - * {@inheritDoc} - */ + /** {@inheritDoc} */ @Override public String getId() { return id.toString(); } - /** - * {@inheritDoc} - */ + /** {@inheritDoc} */ @Override public Sone getSone() { - return soneProvider.getSone(soneId).get(); + return memoryDatabase.getSone(soneId).get(); } - /** - * {@inheritDocs} - */ + /** {@inheritDocs} */ @Override public Optional getRecipientId() { return Optional.fromNullable(recipientId); } - /** - * {@inheritDoc} - */ + /** {@inheritDoc} */ @Override public Optional getRecipient() { - return soneProvider.getSone(recipientId); + return memoryDatabase.getSone(recipientId); } - /** - * {@inheritDoc} - */ + /** {@inheritDoc} */ @Override public long getTime() { return time; } - /** - * {@inheritDoc} - */ + /** {@inheritDoc} */ @Override public String getText() { return text; } - /** - * {@inheritDoc} - */ + /** {@inheritDoc} */ @Override public boolean isKnown() { - return postDatabase.isPostKnown(this); + return memoryDatabase.isPostKnown(this); } - /** - * {@inheritDoc} - */ + /** {@inheritDoc} */ @Override public MemoryPost setKnown(boolean known) { - postDatabase.setPostKnown(this, known); + memoryDatabase.setPostKnown(this, known); return this; } @@ -155,17 +132,13 @@ class MemoryPost implements Post { // OBJECT METHODS // - /** - * {@inheritDoc} - */ + /** {@inheritDoc} */ @Override public int hashCode() { return id.hashCode(); } - /** - * {@inheritDoc} - */ + /** {@inheritDoc} */ @Override public boolean equals(Object object) { if (!(object instanceof MemoryPost)) { @@ -175,9 +148,7 @@ class MemoryPost implements Post { return post.id.equals(id); } - /** - * {@inheritDoc} - */ + /** {@inheritDoc} */ @Override public String toString() { return String.format("%s[id=%s,sone=%s,recipient=%s,time=%d,text=%s]", getClass().getName(), id, soneId, recipientId, time, text);