-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNode.java
More file actions
52 lines (40 loc) · 1.1 KB
/
Node.java
File metadata and controls
52 lines (40 loc) · 1.1 KB
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
import java.util.ArrayList;
public class Node {
private int currentBenefit;
private int currentWeight;
private ArrayList<Decision> decisions;
public Node (int cB, int cW) {
this.setCurrentBenefit(cB);
this.setCurrentWeight(cW);
this.decisions = new ArrayList<Decision>();
}
public int getCurrentBenefit() {
return currentBenefit;
}
public void setCurrentBenefit(int currentBenefit) {
this.currentBenefit = currentBenefit;
}
public int getCurrentWeight() {
return currentWeight;
}
public void setCurrentWeight(int currentWeight) {
this.currentWeight = currentWeight;
}
public void addDecision(Item i, boolean c) {
this.decisions.add(new Decision(i, c));
}
public void addDecisions(ArrayList<Decision> d) {
this.decisions.addAll(d);
}
public ArrayList<Decision> getDecisions() {
return this.decisions;
}
public void print() {
System.out.println("Benefit: " + this.getCurrentBenefit());
System.out.println("Weight: " + this.getCurrentWeight());
System.out.println("----------------------");
for (Decision d : this.decisions) {
System.out.println(d);
}
}
}