-
Notifications
You must be signed in to change notification settings - Fork 0
/
Proces.java
69 lines (54 loc) · 1.21 KB
/
Proces.java
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import java.io.IOException;
import java.io.Writer;
public abstract class Proces {
int weight;
String type;
int value;
int x;
/**
*Constructor apelat de restul claselor care extind Proces
* @param1 cota
* @param2 numele tipului de proces
*/
public Proces (int weight, String type) {
this.weight = weight;
this.type = type;
this.value = 0;
this.x = 0;
}
/**
*Intoarce tipul de proces
*/
public String getType() {
return this.type;
}
/**
*Intoarce cota unui proces
*/
public int getWeight() {
return this.weight;
}
/**
*Calculeaza valoarea intoarsa de un proces pe un numar
*Metoda este suprascrisa in fiecare proces
*/
public abstract void compute();
/**
*Intoarce rezultatul unui proces
*/
public int getResult() {
return this.value;
}
/**
*Seteaza numarul de calculat pentru un proces
*/
public void setX(int x) {
this.x = x;
}
/**
*Scrie rezultatul in fisier
*/
public void showResult(Writer writer) throws IOException {
writer.write(this.x + " " + this.type + " " + this.value + " " + "Computed\n");
}
}