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;
35 private final List<Album> albums = new ArrayList<Album>();
37 /** The images in this album. */
38 private final List<Image> images = new ArrayList<Image>();
40 /** The name of this album. */
43 /** The description of this album. */
44 private String description;
47 * Creates a new album with a random ID.
50 this(UUID.randomUUID().toString());
54 * Creates a new album with the given ID.
59 public Album(String id) {
68 * Returns the ID of this album.
70 * @return The ID of this album
72 public String getId() {
77 * Returns the nested albums.
79 * @return The nested albums
81 public List<Album> getNestedAlbums() {
82 return new ArrayList<Album>(albums);
86 * Returns the images in this album.
88 * @return The images in this album
90 public List<Image> getImages() {
91 return new ArrayList<Image>(images);
95 * Returns the name of this album.
97 * @return The name of this album
99 public String getName() {
104 * Sets the name of this album.
107 * The name of this album
110 public Album setName(String name) {
116 * Returns the description of this album.
118 * @return The description of this album
120 public String getDescription() {
125 * Sets the description of this album.
128 * The description of this album
131 public Album setDescription(String description) {
132 this.description = description;
144 public boolean equals(Object object) {
145 if (!(object instanceof Album)) {
148 Album album = (Album) object;
149 return id.equals(album.id);