Move methods to move an image up and down to Image.
[Sone.git] / src / main / java / net / pterodactylus / sone / data / impl / DefaultAlbum.java
index 161cdd9..32052d5 100644 (file)
@@ -17,8 +17,6 @@
 
 package net.pterodactylus.sone.data.impl;
 
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
 import static com.google.common.base.Preconditions.checkState;
 
 import java.util.ArrayList;
@@ -104,36 +102,6 @@ public class DefaultAlbum extends AbstractAlbum {
        }
 
        @Override
-       public Image moveImageUp(Image image) {
-               checkNotNull(image, "image must not be null");
-               checkNotNull(image.getSone(), "image must have an owner");
-               checkArgument(image.getSone().equals(sone), "image must belong to the same Sone as this album");
-               checkArgument(image.getAlbum().equals(this), "image must belong to this album");
-               int oldIndex = imageIds.indexOf(image.getId());
-               if (oldIndex <= 0) {
-                       return null;
-               }
-               imageIds.remove(image.getId());
-               imageIds.add(oldIndex - 1, image.getId());
-               return images.get(imageIds.get(oldIndex));
-       }
-
-       @Override
-       public Image moveImageDown(Image image) {
-               checkNotNull(image, "image must not be null");
-               checkNotNull(image.getSone(), "image must have an owner");
-               checkArgument(image.getSone().equals(sone), "image must belong to the same Sone as this album");
-               checkArgument(image.getAlbum().equals(this), "image must belong to this album");
-               int oldIndex = imageIds.indexOf(image.getId());
-               if ((oldIndex == -1) || (oldIndex >= (imageIds.size() - 1))) {
-                       return null;
-               }
-               imageIds.remove(image.getId());
-               imageIds.add(oldIndex + 1, image.getId());
-               return images.get(imageIds.get(oldIndex));
-       }
-
-       @Override
        public Image getAlbumImage() {
                if (albumImage == null) {
                        return null;