View Javadoc

1   package org.indi.server;
2   
3   import org.indi.objects.Vector;
4   
5   /**
6    * an object to desribing which vector to observe, how to observe it and which
7    * callback to call if it changeds
8    * 
9    * @author Dirk
10   * 
11   */
12  public class SimpleObserver extends Observer {
13      /**
14       * the callback to be called when the observed vector cahnges
15       */
16      private final ObserverCallback callback;
17  
18      /**
19       * class constructor
20       * 
21       * @param device
22       *                the name of the device the vector to observe belongs to
23       * @param name
24       *                the name of the vector to observe
25       * @param state
26       *                the way the vector should be observed
27       * @param callback
28       *                the callback to be call when the observed vector changes
29       */
30      public SimpleObserver(String device, String name, ObserverState state,
31  	    ObserverCallback callback) {
32  	super(device, name, state);
33  	this.callback = callback;
34      }
35  
36      @Override
37      public void onObserved(Vector vector) {
38  	this.callback.onObserved(vector);
39      }
40  }