Test passed

This commit is contained in:
tuanvu
2025-11-07 11:20:49 +01:00
parent a8aadeec55
commit 588df021b6
4 changed files with 42 additions and 14 deletions

View File

@@ -2,13 +2,31 @@ package impl;
import interfaces.Capteur;
import interfaces.ObserverdeCapteur;
import java.util.concurrent.Future;
public class Afficheur implements ObserverdeCapteur {
private Canal canalAsync;
public Afficheur() {}
public Afficheur(Canal canalAsync) {
this.canalAsync = canalAsync;
}
public void setCanal(Canal canal){
this.canalAsync = canal;
}
//AO1 - concrete servant
//TODO changer capteur à canal
@Override
public void update(Capteur subject) {
subject.getValue();
try{
Future<Integer> futureValue= canalAsync.getValue();
Integer value=futureValue.get();
System.out.println(value);
}catch(Exception e){
//TODO
e.printStackTrace();
}
}
}