-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathTracking.java
More file actions
48 lines (38 loc) · 971 Bytes
/
Copy pathTracking.java
File metadata and controls
48 lines (38 loc) · 971 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
38
39
40
41
42
43
44
45
46
47
48
package components;
/**
*
* @author Nadav Ishai, ID: 206119893
* class Tracking represents a package track
*/
public class Tracking {
private int time;
private Node node;
private Status status;
public Tracking(int time, Node node, Status status) {
this.time = time;
this.node = node;
this.status= status;
}
/**
* copy constructor
* @param t = other Tracking object to copy
*/
public Tracking(Tracking t) {
this.time = t.time;
this.node = t.node;
this.status= t.status;
}
/**
* Tracking toString function
* @return String(Tracking)
*/
public String toString() {
if(node == null)
return time+": Customer, status="+status+"\n";
else if(node instanceof Branch)
return time+": "+((Branch)node).GetBranchName()+", status="+status+"\n";
else if(node instanceof Truck)
return time+": "+((Truck)node).GetTruckName()+", status="+status+"\n";
return "";
}
}