# Interface MaterialSubject

All Known Implementing Classes:
  `MaterialEventPublisher`

public interface MaterialSubject
Subject interface for material events in the Observer pattern. Defines the contract for objects that can notify observers of material events.

This interface allows components to manage observers and broadcast events, enabling the Observer pattern for loose coupling between event sources and handlers.

Since:
  2024-09-15
Version:
  3.0
Author:
  Navid Mohaghegh

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `addObserver(MaterialObserver observer)`
  Adds an observer to receive material events.
  `void`
  `clearObservers()`
  Clears all observers.
  `int`
  `getObserverCount()`
  Gets the number of registered observers.
  `boolean`
  `hasNoObservers()`
  Checks if any observers are registered.
  `void`
  `notifyObservers(MaterialEvent event)`
  Notifies all observers of a material event.
  `boolean`
  `removeObserver(MaterialObserver observer)`
  Removes an observer from receiving material events.

- ## Method Details

  - ### addObserver

    void addObserver(MaterialObserver observer)
    Adds an observer to receive material events.
    Parameters:
      `observer` - the observer to add
    Throws:
      `IllegalArgumentException` - if observer is null

  - ### removeObserver

    boolean removeObserver(MaterialObserver observer)
    Removes an observer from receiving material events.
    Parameters:
      `observer` - the observer to remove
    Returns:
      true if the observer was removed, false if not found

  - ### notifyObservers

    void notifyObservers(MaterialEvent event)
    Notifies all observers of a material event.
    Parameters:
      `event` - the event to broadcast
    Throws:
      `IllegalArgumentException` - if event is null

  - ### getObserverCount

    int getObserverCount()
    Gets the number of registered observers.
    Returns:
      the observer count

  - ### hasNoObservers

    boolean hasNoObservers()
    Checks if any observers are registered.
    Returns:
      true if no observers are registered

  - ### clearObservers

    void clearObservers()
    Clears all observers.