forked from sdmg15/Java-design-patterns
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSubject.java
More file actions
36 lines (25 loc) · 643 Bytes
/
Copy pathSubject.java
File metadata and controls
36 lines (25 loc) · 643 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/**
* Created by sdmg15 on 08/03/17.
*/
package com.patternObsTest;
public class Subject implements Jsubject {
public Jobservers[] tab;
private int length;
public void setLength(valLEngth val){
this.length = val.getVal();
this.noty();
}
public int getLength(){ return this.length;}
@Override
public void attach(Jobservers[] obs){
this.tab = obs;
}
public void detach(int i){
this.tab[i]= new Observer();
}
public void noty(){
for(int i = 0; i < this.tab.length; i++){
System.out.println(this.tab[i].update(this));
}
}
}