Class ModificationWatcher

    • Constructor Detail

      • ModificationWatcher

        public ModificationWatcher()
        Default constructor for two-phase construction.
      • ModificationWatcher

        public ModificationWatcher​(Duration pollFrequency)
        Constructor that accepts a Duration argument representing the poll frequency.
        Parameters:
        pollFrequency - how often to check on IModifiables
    • Method Detail

      • add

        public final boolean add​(IModifiable modifiable,
                                 IChangeListener<IModifiable> listener)
        Description copied from interface: IModificationWatcher
        Adds an IModifiable object and an IChangeListener object to call when the modifiable object is modified.
        Specified by:
        add in interface IModificationWatcher
        Parameters:
        modifiable - an IModifiable object to monitor
        listener - an IChangeListener to call if the IModifiable object is modified
        Returns:
        true if the set did not already contain the specified element
      • remove

        public IModifiable remove​(IModifiable modifiable)
        Description copied from interface: IModificationWatcher
        Removes all entries associated with an IModifiable object.
        Specified by:
        remove in interface IModificationWatcher
        Parameters:
        modifiable - an IModifiable object
        Returns:
        the IModifiable object that was removed, else null
      • start

        public void start​(Duration pollFrequency)
        Description copied from interface: IModificationWatcher
        Starts watching at a given Duration polling rate.
        Specified by:
        start in interface IModificationWatcher
        Parameters:
        pollFrequency - the polling rate Duration
      • checkModified

        protected void checkModified()
        Checks which IModifiables were modified and notifies their listeners