-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNode.java
More file actions
55 lines (45 loc) · 1.19 KB
/
Copy pathNode.java
File metadata and controls
55 lines (45 loc) · 1.19 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
53
54
55
/**
* Class that gives each airport associated with a particular airline, a structure
* airport is not assignment to parent until a specific route needs to be generated
*/
public class Node{
private String code;
private Node parent;
private String Airline;
private int num_stops = 0;
public Node(String code, String Airline, String stops)
{
this(code, null, Airline, stops);
}
public Node(String code, Node parent,String Airline, String stops)
{
this.code = code;
this.parent = parent;
this.Airline = Airline;
if (stops !=null)
this.num_stops = Integer.parseInt(stops);
}
public String getCode(){
return code;
}
public Node getParent(){
return parent;
}
public String getAirlineCode(){
return Airline;
}
public int getNumberStops(){
return num_stops;
}
public void setParent(Node p){
parent = p;
}
@ Override
public String toString(){
String n = Airline;
if(parent != null)
n += " from " + parent.getCode();
n += " to " + code + " " + num_stops + " stops";
return n;
}
}