Class RoomUpdater

java.lang.Object
com.mg105.use_cases.map.RoomUpdater
All Implemented Interfaces:
RoomUpdaterInterface

public class RoomUpdater extends Object implements RoomUpdaterInterface
RoomUpdater updates any components that need updating when the state of the current room changes.

One example of a component that might need updating is the GUI.

RoomUpdater makes use of the Java9+ Observable pattern.

  • Constructor Details

    • RoomUpdater

      public RoomUpdater()
      Create a new RoomUpdater.
  • Method Details

    • updateRoom

      public void updateRoom()
      Trigger an update on all the components that need updating on a room state change.
      Specified by:
      updateRoom in interface RoomUpdaterInterface
    • addObserver

      public void addObserver(@NotNull @NotNull PropertyChangeListener observer)
      Add a new observer to the RoomUpdater.
      Parameters:
      observer - an observer that requires notification of room changes.
    • removeObserver

      public void removeObserver(@NotNull @NotNull PropertyChangeListener observer)
      Remove an observer from the RoomUpdater.
      Parameters:
      observer - an observer that no longer requires notification of room changes.