/*
- * Sone - Album.java - Copyright © 2011–2013 David Roden
+ * Sone - AlbumImpl.java - Copyright © 2011–2015 David Roden
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
import static com.google.common.base.Optional.fromNullable;
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;
import java.util.HashMap;
checkArgument(equals(album.getParent()), "album must belong to this album");
int oldIndex = albums.indexOf(album);
if (oldIndex <= 0) {
- return null;
+ return album;
}
albums.remove(oldIndex);
albums.add(oldIndex - 1, album);
checkArgument(equals(album.getParent()), "album must belong to this album");
int oldIndex = albums.indexOf(album);
if ((oldIndex < 0) || (oldIndex >= (albums.size() - 1))) {
- return null;
+ return album;
}
albums.remove(oldIndex);
albums.add(oldIndex + 1, album);
checkArgument(image.getAlbum().equals(this), "image must belong to this album");
int oldIndex = imageIds.indexOf(image.getId());
if (oldIndex <= 0) {
- return null;
+ return image;
}
imageIds.remove(image.getId());
imageIds.add(oldIndex - 1, image.getId());
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;
+ return image;
}
imageIds.remove(image.getId());
imageIds.add(oldIndex + 1, image.getId());
};
}
- public static class AlbumTitleMustNotBeEmpty extends IllegalStateException { }
-
//
// FINGERPRINTABLE METHODS
//