Package Behavioral.Observer
Class Subject
java.lang.Object
Behavioral.Observer.Subject
- Direct Known Subclasses:
ConcreteSubject
Abstract class for subjects in the Observer pattern.
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Subject
public Subject()Default constructor for Subject.
-
-
Method Details
-
attach
Attaches an observer to the subject.- Parameters:
observer- The observer to attach.
-
detach
Detaches an observer from the subject.- Parameters:
observer- The observer to detach.
-
notifyObservers
Notifies all attached observers of a change.- Parameters:
state- The updated state from the subject.
-