Interface IObserver<E>

Type Parameters:
E - Type of event data that this IObserver subscribes to.
All Known Subinterfaces:
All Known Implementing Classes:
AnalogClock, DigitalClock, ObserverProxy

public interface IObserver<E>

Observer Design Pattern: Define a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically. (Gamma et al, Design Patterns)

Responsibility: Abstract generic definition of the "Observer". pattern role.

Notes: Improves over the original GoF recipe and Java Observer implementation in that:

Example usage:

    // Create Observer Pattern elements 
    ISubject mySubject = new ConcreteSubject();
    IObserver myFirstObserver = new ConcreteObserver();
    IObserver mySecondObserver = new ConcreteObserver();
    // Subscribe multiple Observer instances to the Subject
    mySubject.attach(myFirstObserver, mySecondObserver);
    // Notify all subscribed Observers, optionally pass some Event 
    // data associated with the Event.
    // Detach Observer instances

$Revision: 1.0 $ $Date: Jun 11, 2007 6:16:01 AM $
Giovanni Azua

Method Summary
 void update(E anEventData)
          Notification from ISubject instance that a change has ocurred.

Method Detail


void update(E anEventData)
Notification from ISubject instance that a change has ocurred.

anEventData - Event data pushed to IObserver instances.

Copyright © 2007-2009. All Rights Reserved.