I'm using the Observable class/Observer interface in JAVA to implement the observer pattern. If I have an object that I want to be able to observe several other observable object (multiple observables) and have several observer (multiple observer)
The problem is not anObservable in class B , But I want to value in A and B for generate chart
public void update(Observable anObservable, Object anObject) {
if(anObservable instanceof A){
createDataSet(anObservable,null);
}
else if(anObservable instanceof B)
{
createDataSet(null,anObservable);
}
}
private void (Observable anSampleObservable,Observable anAreaObservable){
// To do something with value in anSampleObservable (A) and value in anAreaObservable(B)}
Any advice? Thanks.