-
Notifications
You must be signed in to change notification settings - Fork 0
/
Station.java
69 lines (57 loc) · 1.68 KB
/
Station.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
package cn.edu.zucc.personplan.ui;
import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.Map;
public class Station {
private String name;
public Station prev;
public Station next;
public String line;//存放该站为几号线
private Map<Station,LinkedHashSet<Station>> orderSetMap = new HashMap<Station,LinkedHashSet<Station>>();
public Station (String name){
this.name = name;
this.line = name;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public LinkedHashSet<Station> getAllPassedStations(Station station) {
if(orderSetMap.get(station) == null){
LinkedHashSet<Station> set = new LinkedHashSet<Station>();
set.add(this);
orderSetMap.put(station, set);
}
return orderSetMap.get(station);
}
public Map<Station, LinkedHashSet<Station>> getOrderSetMap() {
return orderSetMap;
}
@Override
public boolean equals(Object obj) {
if(this == obj){
return true;
} else if(obj instanceof Station){
Station s = (Station) obj;
if(s.getName().equals(this.getName())){
return true;
} else {
return false;
}
} else {
return false;
}
}
@Override
public int hashCode() {
return this.getName().hashCode();
}
public void setLine(String station){
this.line=station;
}
public String getline(){
return this.line;
}
}