Test passed
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user