Class Observer
- java.lang.Object
-
- Observer
-
public class Observer extends java.lang.Object
This class observes the changes of an integer property in a set of observable objects. It holds a set of settable objects. When the property changes the observer sets the new value of the property to each settable object.Generally, observers have methods to add and remove observables. For simplicity, here all the observable are set in one shot. This is less general, but it suffices for this problem and is less distracting.
-
-
Constructor Summary
Constructors Constructor Description Observer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
setSettable(Settable[] settable)
Set the observable of this observer.void
update(Settable originator, int newValue)
Update the settables with a new value.
-
-
-
Method Detail
-
setSettable
public void setSettable(Settable[] settable)
Set the observable of this observer.- Parameters:
settable
- The array of objectobservable to set.
-
update
public void update(Settable originator, int newValue)
Update the settables with a new value.- Parameters:
newValue
- The new value to set in the settable.
-
-