X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fdata%2FSone.java;h=3923f667d2e2b1ebebf987488d3cbf2cef271a82;hb=a88e930a23b550dae75116d7759924d760941776;hp=ac6e41ae2c7c61c96c5cbec8f290ecd8a5726348;hpb=50ce65f69e49ed10abeedaeb6615ffb37a0c0772;p=Sone.git diff --git a/src/main/java/net/pterodactylus/sone/data/Sone.java b/src/main/java/net/pterodactylus/sone/data/Sone.java index ac6e41a..3923f66 100644 --- a/src/main/java/net/pterodactylus/sone/data/Sone.java +++ b/src/main/java/net/pterodactylus/sone/data/Sone.java @@ -175,6 +175,9 @@ public class Sone implements Fingerprintable, Comparable { /** The ID of this Sone. */ private final String id; + /** Whether the Sone is local. */ + private final boolean local; + /** The identity of this Sone. */ private Identity identity; @@ -229,9 +232,13 @@ public class Sone implements Fingerprintable, Comparable { * * @param id * The ID of the Sone + * @param local + * {@code true} if the Sone is a local Sone, {@code false} + * otherwise */ - public Sone(String id) { + public Sone(String id, boolean local) { this.id = id; + this.local = local; } // @@ -284,6 +291,16 @@ public class Sone implements Fingerprintable, Comparable { } /** + * Returns whether this Sone is a local Sone. + * + * @return {@code true} if this Sone is a local Sone, {@code false} + * otherwise + */ + public boolean isLocal() { + return local; + } + + /** * Returns the request URI of this Sone. * * @return The request URI of this Sone @@ -791,7 +808,9 @@ public class Sone implements Fingerprintable, Comparable { */ public void addAlbum(Album album) { Validation.begin().isNotNull("Album", album).check().isEqual("Album Owner", album.getSone(), this).check(); - albums.add(album); + if (!albums.contains(album)) { + albums.add(album); + } } /**