-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathTask.java
94 lines (83 loc) · 1.83 KB
/
Task.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
import java.util.ArrayList;
/**
* Node class for Graph
* @author kristebo
*
*/
public class Task {
public ArrayList<Task> outEdge;
private int id , time;
private String name ;
private int earliestStart , latestStart ;
private int manpower;
private ArrayList<Integer> preds;
/**
* Constructor limited workforce, manpower does not limit
*/
public Task(int id, String name,int time, int staff, ArrayList<Integer> preds){
this.id=id;
this.time=time;
this.name=name;
this.manpower=staff;
this.preds=preds;
outEdge=new ArrayList<>();
}
/**
* A simple tostring method.
*/
public String toString(){
String ret1=String.format("ID: %s\nName: %s\nStaff: %s \nPredecessors:", id, name, manpower);
String p="";
if (preds!=null){
for (Integer s: preds) p=p+" "+ s;
return ret1.concat(p);
}
return ret1.concat("\nNo predecessors");
}
/**
* Gets the predecessors defined in this task.
*
* @return ArrayList of integers this tasks predecessors as a ArrayList of integers.
*/
public ArrayList<Integer> getPredecessors(){
return preds;
}
/**********************************************
* PUBLIC METHODS
* GETTERS
*
*
**********************************************/
public int getId() {
return id;
}
public int getTime() {
return time;
}
public String getName() {
return name;
}
public int getEarliestStart() {
return earliestStart;
}
public int getLatestStart() {
return latestStart;
}
/**
* Sets the latest start this task will start at.
* @param latestStart
*/
public void setLatestStart(int latestStart){
this.latestStart=latestStart;
}
/**
* Sets the earliest start this task can begin at.
* @param earliestStart
*/
public void setEarliestStart(int earliestStart){
this.earliestStart=earliestStart;
}
public int getManpower() {
return manpower;
}
}