- All Implemented Interfaces:
Observer
Concrete implementation of an Observer in the Observer pattern.
-
Constructor Summary
Constructors
Constructor for ConcreteObserver.
-
Method Summary
Gets the name of the observer.
void
Handles updates from the subject.
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
ConcreteObserver
public ConcreteObserver(String name)
Constructor for ConcreteObserver.
- Parameters:
name - The name of the observer.
-
Method Details
-
update
public void update(String state)
Handles updates from the subject.
- Specified by:
update in interface Observer
- Parameters:
state - The updated state from the subject.
-
getName
Gets the name of the observer.
- Returns:
- The name of the observer.