Graphic Rendering System 1.0
A Java-based graphic rendering system implementing various design patterns
Loading...
Searching...
No Matches
com.example.graphics.observer.ShapeSubject Class Reference
Collaboration diagram for com.example.graphics.observer.ShapeSubject:
Collaboration graph

Public Member Functions

 ShapeSubject ()
void addObserver (ShapeObserver observer)
void notifyShapeAdded (Shape shape)
void notifyShapeModified (Shape shape)
void notifyShapeRemoved (Shape shape)
void removeObserver (ShapeObserver observer)

Private Attributes

final List< ShapeObserverobservers

Detailed Description

Subject class for the Observer pattern. This maintains a list of observers and notifies them of changes.

Definition at line 11 of file ShapeSubject.java.

Constructor & Destructor Documentation

◆ ShapeSubject()

com.example.graphics.observer.ShapeSubject.ShapeSubject ( )
inline

Constructor initializes the observer list

Definition at line 17 of file ShapeSubject.java.

References observers.

Member Function Documentation

◆ addObserver()

void com.example.graphics.observer.ShapeSubject.addObserver ( ShapeObserver observer)
inline

Add an observer to be notified of changes

Parameters
observerthe observer to add

Definition at line 25 of file ShapeSubject.java.

References observers.

◆ notifyShapeAdded()

void com.example.graphics.observer.ShapeSubject.notifyShapeAdded ( Shape shape)
inline

Notify all observers that a shape was added

Parameters
shapethe shape that was added

Definition at line 43 of file ShapeSubject.java.

References observers.

◆ notifyShapeModified()

void com.example.graphics.observer.ShapeSubject.notifyShapeModified ( Shape shape)
inline

Notify all observers that a shape was modified

Parameters
shapethe shape that was modified

Definition at line 63 of file ShapeSubject.java.

References observers.

◆ notifyShapeRemoved()

void com.example.graphics.observer.ShapeSubject.notifyShapeRemoved ( Shape shape)
inline

Notify all observers that a shape was removed

Parameters
shapethe shape that was removed

Definition at line 53 of file ShapeSubject.java.

References observers.

◆ removeObserver()

void com.example.graphics.observer.ShapeSubject.removeObserver ( ShapeObserver observer)
inline

Remove an observer from the notification list

Parameters
observerthe observer to remove

Definition at line 35 of file ShapeSubject.java.

References observers.

Member Data Documentation

◆ observers

final List<ShapeObserver> com.example.graphics.observer.ShapeSubject.observers
private

The documentation for this class was generated from the following file: