Update afficheur
This commit is contained in:
@@ -2,10 +2,13 @@ package impl;
|
||||
|
||||
import interfaces.Capteur;
|
||||
import interfaces.ObserverdeCapteur;
|
||||
|
||||
import java.util.Random;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
public class Afficheur implements ObserverdeCapteur {
|
||||
private Canal canalAsync;
|
||||
private int id= new Random().nextInt(100);
|
||||
|
||||
public Afficheur() {}
|
||||
|
||||
@@ -23,7 +26,7 @@ public class Afficheur implements ObserverdeCapteur {
|
||||
try{
|
||||
Future<Integer> futureValue= canalAsync.getValue();
|
||||
Integer value=futureValue.get();
|
||||
System.out.println(value);
|
||||
System.out.println("Afficheur " + id+", value: "+ value);
|
||||
}catch(Exception e){
|
||||
//TODO
|
||||
e.printStackTrace();
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
package interfaces;
|
||||
public interface Observer<T> {
|
||||
public void update(T subject);
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
package interfaces;
|
||||
public interface ObserverdeCapteur extends Observer<Capteur>{
|
||||
public interface ObserverdeCapteur{
|
||||
//AO1 - servant
|
||||
@Override
|
||||
public void update(Capteur subject);
|
||||
}
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
package interfaces;
|
||||
public interface Subject {
|
||||
public void attach(Observer o);
|
||||
public void detach(Observer o);
|
||||
}
|
||||
Reference in New Issue
Block a user