-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathControladorGrua.java
More file actions
37 lines (28 loc) · 872 Bytes
/
ControladorGrua.java
File metadata and controls
37 lines (28 loc) · 872 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
37
package cc.controlReciclado;
import es.upm.babel.cclib.ConcIO;
public class ControladorGrua extends Thread {
private final int indice;
private final ApiGruas gruas;
private final ControlReciclado cr;
public ControladorGrua (int indice,
ApiGruas gruas,
ControlReciclado cr) {
this.indice = indice;
this.gruas = gruas;
this.cr = cr;
}
public void run () {
while (true) {
int peso;
ConcIO.printfnl("Grua %d inicio recoger", indice);
peso = gruas.recoger(indice);
ConcIO.printfnl("Grua %d recogión %d", indice, peso);
cr.notificarPeso(peso);
cr.incrementarPeso(peso);
ConcIO.printfnl("Grua %d inicia soltar", indice);
gruas.soltar(indice);
ConcIO.printfnl("Grua %d soltó %d", indice, peso);
cr.notificarSoltar();
}
}
}