From: David ‘Bombe’ Roden Date: Tue, 15 Oct 2013 04:38:14 +0000 (+0200) Subject: Only rely on the database interface. X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=d72e0ec245f020d9b4baa90814a08a22cd0264f3;p=Sone.git Only rely on the database interface. --- diff --git a/src/main/java/net/pterodactylus/sone/database/memory/MemoryImage.java b/src/main/java/net/pterodactylus/sone/database/memory/MemoryImage.java index d2c743e..c00759e 100644 --- a/src/main/java/net/pterodactylus/sone/database/memory/MemoryImage.java +++ b/src/main/java/net/pterodactylus/sone/database/memory/MemoryImage.java @@ -21,6 +21,7 @@ import net.pterodactylus.sone.data.Album; import net.pterodactylus.sone.data.Image; import net.pterodactylus.sone.data.Sone; import net.pterodactylus.sone.data.impl.AbstractImage; +import net.pterodactylus.sone.database.Database; /** * In-memory implementation of an {@link Image}. @@ -29,13 +30,13 @@ import net.pterodactylus.sone.data.impl.AbstractImage; */ public class MemoryImage extends AbstractImage { - private final MemoryDatabase memoryDatabase; + private final Database database; private final Sone sone; /* TODO - store sone ID only. */ private final String albumId; - public MemoryImage(MemoryDatabase memoryDatabase, String id, Sone sone, String albumId, String key, long creationTime, int width, int height) { + public MemoryImage(Database database, String id, Sone sone, String albumId, String key, long creationTime, int width, int height) { super(id, key, creationTime, width, height); - this.memoryDatabase = memoryDatabase; + this.database = database; this.sone = sone; this.albumId = albumId; } @@ -47,22 +48,22 @@ public class MemoryImage extends AbstractImage { @Override public Album getAlbum() { - return memoryDatabase.getAlbum(albumId).get(); + return database.getAlbum(albumId).get(); } @Override public void moveUp() throws IllegalStateException { - memoryDatabase.moveUp(this); + database.moveUp(this); } @Override public void moveDown() throws IllegalStateException { - memoryDatabase.moveDown(this); + database.moveDown(this); } @Override public void remove() throws IllegalStateException { - memoryDatabase.removeImage(this); + database.removeImage(this); } }