2 * Sone - Album.java - Copyright © 2011–2020 David Roden
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 package net.pterodactylus.sone.data;
20 import java.util.List;
23 * Container for images that can also contain nested {@link Album}s.
25 public interface Album extends Identified, Fingerprintable {
28 * Returns the ID of this album.
30 * @return The ID of this album
35 * Returns the Sone this album belongs to.
37 * @return The Sone this album belongs to
42 * Returns the nested albums.
44 * @return The nested albums
46 List<Album> getAlbums();
49 * Adds an album to this album.
54 void addAlbum(Album album);
57 * Removes an album from this album.
62 void removeAlbum(Album album);
65 * Moves the given album up in this album’s albums. If the album is already the
66 * first album, nothing happens.
69 * The album to move up
70 * @return The album that the given album swapped the place with, or
71 * <code>null</code> if the album did not change its place
73 Album moveAlbumUp(Album album);
76 * Moves the given album down in this album’s albums. If the album is already
77 * the last album, nothing happens.
80 * The album to move down
81 * @return The album that the given album swapped the place with, or
82 * <code>null</code> if the album did not change its place
84 Album moveAlbumDown(Album album);
87 * Returns the images in this album.
89 * @return The images in this album
91 List<Image> getImages();
94 * Adds the given image to this album.
99 void addImage(Image image);
102 * Removes the given image from this album.
105 * The image to remove
107 void removeImage(Image image);
110 * Moves the given image up in this album’s images. If the image is already the
111 * first image, nothing happens.
114 * The image to move up
115 * @return The image that the given image swapped the place with, or
116 * <code>null</code> if the image did not change its place
118 Image moveImageUp(Image image);
121 * Moves the given image down in this album’s images. If the image is already
122 * the last image, nothing happens.
125 * The image to move down
126 * @return The image that the given image swapped the place with, or
127 * <code>null</code> if the image did not change its place
129 Image moveImageDown(Image image);
132 * Returns whether this album contains any other albums or images.
134 * @return {@code true} if this album is empty, {@code false} otherwise
139 * Returns whether this album is an identitiy’s root album.
141 * @return {@code true} if this album is an identity’s root album, {@code
147 * Returns the parent album of this album.
149 * @return The parent album of this album, or {@code null} if this album does
155 * Sets the parent album of this album.
158 * The new parent album of this album
161 Album setParent(Album parent);
164 * Removes the parent album of this album.
168 Album removeParent();
171 * Returns the title of this album.
173 * @return The title of this album
178 * Returns the description of this album.
180 * @return The description of this album
182 String getDescription();
185 * Returns a modifier for this album.
187 * @return A modifier for this album
188 * @throws IllegalStateException
189 * if this album can not be modified
191 Modifier modify() throws IllegalStateException;
194 * Allows modifying an album. Modifications are only performed once {@link
195 * #update()} has succesfully returned a new album with the modifications
200 Modifier setTitle(String title);
202 Modifier setDescription(String description);
204 Album update() throws IllegalStateException;
206 class AlbumTitleMustNotBeEmpty extends IllegalStateException { }