2 * Sone - Album.java - Copyright © 2011 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.ArrayList;
21 import java.util.List;
22 import java.util.UUID;
25 * Container for images that can also contain nested {@link Album}s.
27 * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
31 /** The ID of this album. */
32 private final String id;
34 /** The Sone this album belongs to. */
35 private final Sone sone;
38 private final List<Album> albums = new ArrayList<Album>();
40 /** The images in this album. */
41 private final List<Image> images = new ArrayList<Image>();
43 /** The name of this album. */
46 /** The description of this album. */
47 private String description;
50 * Creates a new album with a random ID.
53 * The Sone this album belongs to
55 public Album(Sone sone) {
56 this(UUID.randomUUID().toString(), sone);
60 * Creates a new album with the given ID.
65 * The Sone this album belongs to
67 public Album(String id, Sone sone) {
77 * Returns the ID of this album.
79 * @return The ID of this album
81 public String getId() {
86 * Returns the Sone this album belongs to.
88 * @return The Sone this album belongs to
90 public Sone getSone() {
95 * Returns the nested albums.
97 * @return The nested albums
99 public List<Album> getNestedAlbums() {
100 return new ArrayList<Album>(albums);
104 * Returns the images in this album.
106 * @return The images in this album
108 public List<Image> getImages() {
109 return new ArrayList<Image>(images);
113 * Returns the name of this album.
115 * @return The name of this album
117 public String getName() {
122 * Sets the name of this album.
125 * The name of this album
128 public Album setName(String name) {
134 * Returns the description of this album.
136 * @return The description of this album
138 public String getDescription() {
143 * Sets the description of this album.
146 * The description of this album
149 public Album setDescription(String description) {
150 this.description = description;
162 public boolean equals(Object object) {
163 if (!(object instanceof Album)) {
166 Album album = (Album) object;
167 return sone.equals(album.sone) && id.equals(album.id);