X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fdata%2FSone.java;h=9d594072b600c1d7f6873f9f38eb4a8473361642;hb=4d23b48e1e973d3fab7fdad7c0aeda5557a9a03f;hp=2efb90d9185be90a53c2ebeb674f3e01a6de46d7;hpb=7105c9338f9c7ec88da8044645482ecc09458cd0;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 2efb90d..9d59407 100644 --- a/src/main/java/net/pterodactylus/sone/data/Sone.java +++ b/src/main/java/net/pterodactylus/sone/data/Sone.java @@ -67,11 +67,14 @@ public class Sone { private final Set friendSones = new HashSet(); /** All posts. */ - private final List posts = new ArrayList(); + private final Set posts = new HashSet(); /** All replies. */ private final Set replies = new HashSet(); + /** The IDs of all blocked Sones. */ + private final Set blockedSoneIds = new HashSet(); + /** Modification count. */ private volatile long modificationCounter = 0; @@ -377,6 +380,48 @@ public class Sone { } /** + * Returns the IDs of all blocked Sones. These Sones will not propagated + * using the “known Sones” mechanism. + * + * @return The IDs of all blocked Sones + */ + public Set getBlockedSoneIds() { + return Collections.unmodifiableSet(blockedSoneIds); + } + + /** + * Returns whether the given Sone ID is blocked. + * + * @param soneId + * The Sone ID to check + * @return {@code true} if the given Sone ID is blocked, {@code false} + * otherwise + */ + public boolean isSoneBlocked(String soneId) { + return blockedSoneIds.contains(soneId); + } + + /** + * Adds the given ID to the list of blocked IDs. + * + * @param soneId + * The Sone ID to block + */ + public void addBlockedSoneId(String soneId) { + blockedSoneIds.add(soneId); + } + + /** + * Removes the given ID from the list of blocked IDs. + * + * @param soneId + * The Sone ID to unblock + */ + public void removeBlockedSoneId(String soneId) { + blockedSoneIds.remove(soneId); + } + + /** * Returns the modification counter. * * @return The modification counter