|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectgame.pubsub.BasePublisher<E>
E - the event type for notificationpublic class BasePublisher<E extends PubSubEvent>
Simple implementation of a Publisher that keeps track of Subscribers using a LinkedList
| Constructor Summary | |
|---|---|
BasePublisher()
|
|
| Method Summary | |
|---|---|
void |
addSubscriber(Subscriber<E> subscriber)
Add a new subscriber. |
void |
notifySubscribers(E e)
Informs all subscribers than an event has occured by calling their observeEvent() method. |
void |
removeSubscriber(Subscriber<E> subscriber)
Remove a subscriber. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public BasePublisher()
| Method Detail |
|---|
public void addSubscriber(Subscriber<E> subscriber)
addSubscriber in interface Publisher<E extends PubSubEvent>subscriber - is the new subscriber being addedpublic void removeSubscriber(Subscriber<E> subscriber)
removeSubscriber in interface Publisher<E extends PubSubEvent>subscriber - is the subscriber being removedpublic final void notifySubscribers(E e)
notifySubscribers in interface Publisher<E extends PubSubEvent>e - the event to be passed onto the subscribers
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||