X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fnotify%2FNewSoneNotification.java;h=f3388b10ef7887eb725d8b13a75bd514b89935b0;hb=bb075f1e55e6c0526594c8a9cd33c2afcf75cce6;hp=1d96be5899ceb27570e6beb3a44237b78998639a;hpb=5257453a433d221f92b4b9a5f41ebc38cd6baaa4;p=Sone.git
diff --git a/src/main/java/net/pterodactylus/sone/notify/NewSoneNotification.java b/src/main/java/net/pterodactylus/sone/notify/NewSoneNotification.java
index 1d96be5..f3388b1 100644
--- a/src/main/java/net/pterodactylus/sone/notify/NewSoneNotification.java
+++ b/src/main/java/net/pterodactylus/sone/notify/NewSoneNotification.java
@@ -26,34 +26,62 @@ import net.pterodactylus.util.notify.TemplateNotification;
import net.pterodactylus.util.template.Template;
/**
- * TODO
+ * Notification that signals that new Sones have been discovered.
*
* @author David âBombeâ Roden
*/
public class NewSoneNotification extends TemplateNotification {
+ /** The new Sones. */
private List newSones = Collections.synchronizedList(new ArrayList());
/**
- * TODO
+ * Creates a new ânew Sone discoveredâ notification.
+ *
+ * @param template
+ * The template to render
*/
public NewSoneNotification(Template template) {
super(template);
+ template.set("sones", newSones);
}
//
// ACCESSORS
//
+ /**
+ * Returns whether there are any new Sones.
+ *
+ * @return {@code true} if there are no new Sones, {@code false} if there
+ * are new Sones
+ */
public boolean isEmpty() {
return newSones.isEmpty();
}
+ /**
+ * Adds a discovered Sone.
+ *
+ * @param sone
+ * The new Sone
+ */
public void addSone(Sone sone) {
newSones.add(sone);
touch();
}
+ /**
+ * Removes the given Sone from the list of new Sones.
+ *
+ * @param sone
+ * The Sone to remove
+ */
+ public void removeSone(Sone sone) {
+ newSones.remove(sone);
+ touch();
+ }
+
//
// ABSTRACTNOTIFICATION METHODS
//