-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGeoInfo.java
More file actions
25 lines (21 loc) · 769 Bytes
/
Copy pathGeoInfo.java
File metadata and controls
25 lines (21 loc) · 769 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
public class GeoInfo {
private ST<String, Location> st;
public GeoInfo(String filename, SymbolEWDigraph map) {
this.st = new ST<String, Location>();
In in = new In(filename);
while (in.hasNextLine()) {
String line = in.readLine();
if (line.startsWith(" <node")) {
String[] lineSplit = line.split("\"");
if (map.contains(lineSplit[1]))
st.put(lineSplit[1], new Location(Double.parseDouble(lineSplit[15]), Double.parseDouble(lineSplit[17])));
}
}
}
public Location get(String id) {
return(st.get(id));
}
public Iterable<String> nodes() {
return st.keys();
}
}