Skip to content
Snippets Groups Projects
Commit 635a5faa authored by Soufiane's avatar Soufiane
Browse files

Q3 TO COMPLETE

parent 0a09fa1c
No related branches found
No related tags found
No related merge requests found
package fr.univlille.iut.r304.tp3.q3;
public class ConnectableProperty extends ObservableProperty {
import fr.univlille.iut.r304.tp3.q1.Observable;
import fr.univlille.iut.r304.tp3.q1.Observer;
public class ConnectableProperty extends ObservableProperty implements Observer{
public void connectTo(ConnectableProperty other) {
this.attach(other);
this.setValue(other.getValue());
}
public void biconnectTo(ConnectableProperty other) {
this.connectTo(other);
other.attach(this);
}
public void unconnectFrom(ConnectableProperty other) {
this.detach(other);
}
@Override
public void update(Observable subj) {
}
@Override
public void update(Observable subj, Object data) {
this.property = data;
}
}
package fr.univlille.iut.r304.tp3.q3;
import fr.univlille.iut.r304.tp3.q1.Observer;
import fr.univlille.iut.r304.tp3.q1.Observable;
public class ObservableProperty {
public class ObservableProperty extends Observable {
public void setValue(Object i) {
protected Object property;
public ObservableProperty(Object property){
this.property = property;
}
public Object getValue() {
return null;
public ObservableProperty(){
this(null);
}
public void attach(Observer observer) {
// methode cree pour que les tests compilent sans erreur
// n'est pas censée rester une fois que vous avez fini Q2.1
public void setValue(Object i) {
this.property = i;
this.notifyObservers(i);
}
public void detach(Observer observer) {
// methode cree pour que les tests compilent sans erreur
// n'est pas censée rester une fois que vous avez fini Q2.1
public Object getValue() {
return this.property;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment