net.wimpi.modbus.util
Class Observable

java.lang.Object
  extended by net.wimpi.modbus.util.Observable
Direct Known Subclasses:
ObservableDigitalOut, ObservableRegister

public class Observable
extends Object

A cleanroom implementation of the Observable pattern.

Version:
@version@ (@date@)
Author:
Dieter Wimberger (wimpi)

Constructor Summary
Observable()
          Constructs a new Observable instance.
 
Method Summary
 void addObserver(Observer o)
          Adds an observer instance if it is not already in the set of observers for this Observable.
 int getObserverCount()
           
 void notifyObservers(Object arg)
          Notifies all observer instances in the set of observers of this Observable.
 void removeObserver(Observer o)
          Removes an observer instance from the set of observers of this Observable.
 void removeObservers()
          Removes all observer instances from the set of observers of this Observable.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Observable

public Observable()
Constructs a new Observable instance.

Method Detail

getObserverCount

public int getObserverCount()

addObserver

public void addObserver(Observer o)
Adds an observer instance if it is not already in the set of observers for this Observable.

Parameters:
o - an observer instance to be added.

removeObserver

public void removeObserver(Observer o)
Removes an observer instance from the set of observers of this Observable.

Parameters:
o - an observer instance to be removed.

removeObservers

public void removeObservers()
Removes all observer instances from the set of observers of this Observable.


notifyObservers

public void notifyObservers(Object arg)
Notifies all observer instances in the set of observers of this Observable.

Parameters:
arg - an arbitrary argument to be passed.


Copyright © 2010. All Rights Reserved.