projects
/
Sone.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add method to remove a Sone, re-add isEmpty() method.
[Sone.git]
/
src
/
main
/
java
/
net
/
pterodactylus
/
sone
/
notify
/
NewSoneNotification.java
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
(file)
--- 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;
/**
import net.pterodactylus.util.template.Template;
/**
- *
TODO
+ *
Notification that signals that new Sones have been discovered.
*
* @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
*/
public class NewSoneNotification extends TemplateNotification {
*
* @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
*/
public class NewSoneNotification extends TemplateNotification {
+ /** The new Sones. */
private List<Sone> newSones = Collections.synchronizedList(new ArrayList<Sone>());
/**
private List<Sone> newSones = Collections.synchronizedList(new ArrayList<Sone>());
/**
- * TODO
+ * Creates a new “new Sone discovered” notification.
+ *
+ * @param template
+ * The template to render
*/
public NewSoneNotification(Template template) {
super(template);
*/
public NewSoneNotification(Template template) {
super(template);
+ template.set("sones", newSones);
}
//
// ACCESSORS
//
}
//
// 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();
}
public boolean isEmpty() {
return newSones.isEmpty();
}
+ /**
+ * Adds a discovered Sone.
+ *
+ * @param sone
+ * The new Sone
+ */
public void addSone(Sone sone) {
newSones.add(sone);
touch();
}
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
//
//
// ABSTRACTNOTIFICATION METHODS
//