29 lines
698 B
Java
29 lines
698 B
Java
package impl;
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
|
|
import interfaces.AlgoDiffusion;
|
|
import interfaces.Capteur;
|
|
import interfaces.ObserverDeCapteurAsync;
|
|
|
|
public class DiffusionAtomique implements AlgoDiffusion {
|
|
|
|
public CapteurImpl capteur;
|
|
|
|
@Override
|
|
public void configure() {
|
|
// TODO Auto-generated method stub
|
|
throw new UnsupportedOperationException("Unimplemented method 'configure'");
|
|
}
|
|
|
|
@Override
|
|
public void execute() {
|
|
capteur.lock(); //TODO unlock
|
|
List<ObserverDeCapteurAsync> canaux = capteur.observers;
|
|
for (ObserverDeCapteurAsync canal : canaux) {
|
|
canal.update(this.capteur);
|
|
}
|
|
}
|
|
}
|