All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class observable.ObservableRatio

java.lang.Object
   |
   +----observable.ObservableRatio

public class ObservableRatio
extends Object
implements Observer
This rather neat class uses allows a relationship (here, a ratio) to be maintained between two Observable doubles. When either of the two changes, the other is modified to maintain the ratio between them.

Version:
$Revision: 1.1.1.1 $, $Date: 1999/11/15 20:37:49 $.
Author:
Daren Stotler
See Also:
ObservableDbl

Constructor Index

 o ObservableRatio(ObservableDbl, ObservableDbl, double)
The constructor requires not only the names of the two ObservableDbl's, but also their ratio.

Method Index

 o update(Observable, Object)
This method watches a change in one of the two ObservableDbl's and then updates the other.

Constructors

 o ObservableRatio
 public ObservableRatio(ObservableDbl od1,
                        ObservableDbl od2,
                        double r)
The constructor requires not only the names of the two ObservableDbl's, but also their ratio.

Parameters:
od1 - first ObservableDbl
od2 - second ObservableDbl
r - ratio of the first ObservableDbl to the second

Methods

 o update
 public void update(Observable obs,
                    Object arg)
This method watches a change in one of the two ObservableDbl's and then updates the other. Note: this will probably get called twice with each change. The second call will have no effect.


All Packages  Class Hierarchy  This Package  Previous  Next  Index