net.sf.okapi.common.observer

## Interface IObservable

- All Known Implementing Classes:
    BaseObservable, Pipeline, WeakReferenceObservable

      public interface IObservable

  This interface is intended to provide more flexibility to complex object models when multiple inheritance is needed.

  By providing Observable as an interface, instead of the JDK'a `Observable` class, client classes have the option to mimic multiple inheritance by means of a delegate pattern which uses an inner private class which implements this interface.

  This class is based on the work done by Martin Fischer, with only minor changes. See references below.

  Author:
    Martin Fischer (original author), Richard Gomes
  See Also:
    Martin Fischer: Observer and Observable interfaces, Improved Observer/Observable

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addObserver(IObserver observer)` Attaches a observer to the Observable.
    `int` | `countObservers()` Counts how many Observers were attached to this class.
    `void` | `deleteObserver(IObserver observer)` Detaches a previously attached observer to the observable.
    `void` | `deleteObservers()` Detaches all previously attached observer to the observable.
    `java.util.List<IObserver>` | `getObservers()` Returns list of observers registered with the Observable.
    `void` | `notifyObservers()` Notifies all attached observers about changes in the observable.
    `void` | `notifyObservers(java.lang.Object arg)` Notifies all attached observers about changes in the observable.

- - ### Method Detail

    - #### addObserver

          void addObserver(IObserver observer)

      Attaches a observer to the Observable. After attachment the observer gets informed about changes in the Observable.
      Parameters:
        `observer` - The observer to attach to the observable

    - #### countObservers

          int countObservers()

      Counts how many Observers were attached to this class.
      Returns:
        the number of Observers
      See Also:
        `IObserver`

    - #### getObservers

          java.util.List<IObserver> getObservers()

      Returns list of observers registered with the Observable. List returned is unmodifiable list.
      Returns:
        list of observers

    - #### deleteObserver

          void deleteObserver(IObserver observer)

      Detaches a previously attached observer to the observable. After detachment the observer does no longer receive change notifications from the observable.
      Parameters:
        `observer` - The observer to detach from the observable

    - #### deleteObservers

          void deleteObservers()

      Detaches all previously attached observer to the observable. After detachment observers do not longer receive change notifications from the observable.

    - #### notifyObservers

          void notifyObservers()

      Notifies all attached observers about changes in the observable.

    - #### notifyObservers

          void notifyObservers(java.lang.Object arg)

      Notifies all attached observers about changes in the observable.
      Parameters:
        `arg` - an arbitrary Object to be passed to the Observer