From fef93a83c728ca853ea93872e870130512af3fcb Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Sat, 1 Jan 2011 13:49:35 +0100 Subject: [PATCH] Add owner Sone to album. --- .../java/net/pterodactylus/sone/data/Album.java | 26 ++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/src/main/java/net/pterodactylus/sone/data/Album.java b/src/main/java/net/pterodactylus/sone/data/Album.java index 919f797..67bfefd 100644 --- a/src/main/java/net/pterodactylus/sone/data/Album.java +++ b/src/main/java/net/pterodactylus/sone/data/Album.java @@ -31,6 +31,9 @@ public class Album { /** The ID of this album. */ private final String id; + /** The Sone this album belongs to. */ + private final Sone sone; + /** Nested albums. */ private final List albums = new ArrayList(); @@ -45,9 +48,12 @@ public class Album { /** * Creates a new album with a random ID. + * + * @param sone + * The Sone this album belongs to */ - public Album() { - this(UUID.randomUUID().toString()); + public Album(Sone sone) { + this(UUID.randomUUID().toString(), sone); } /** @@ -55,9 +61,12 @@ public class Album { * * @param id * The ID of the album + * @param sone + * The Sone this album belongs to */ - public Album(String id) { + public Album(String id, Sone sone) { this.id = id; + this.sone = sone; } // @@ -74,6 +83,15 @@ public class Album { } /** + * Returns the Sone this album belongs to. + * + * @return The Sone this album belongs to + */ + public Sone getSone() { + return sone; + } + + /** * Returns the nested albums. * * @return The nested albums @@ -146,7 +164,7 @@ public class Album { return false; } Album album = (Album) object; - return id.equals(album.id); + return sone.equals(album.sone) && id.equals(album.id); } } -- 2.7.4