blob: 34048acd598ae56d431946f853ec43261bb9db73 (
plain)
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
|
package com.benburwell.planes.graph;
import com.benburwell.planes.data.Intersection;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
/**
* @author ben
*/
public class RouteGraph {
private Map<String,Airway> airways = new HashMap<>();
public void addIntersection(Intersection in) {
if (!this.airways.containsKey(in.getAirway1())) {
this.airways.put(in.getAirway1(), new Airway(in.getAirway1()));
}
if (!this.airways.containsKey(in.getAirway2())) {
this.airways.put(in.getAirway2(), new Airway(in.getAirway2()));
}
this.airways.get(in.getAirway1()).addPoint(in.getLatitude(), in.getLongitude());
this.airways.get(in.getAirway2()).addPoint(in.getLatitude(), in.getLongitude());
}
public Collection<Airway> getAirways() {
return this.airways.values();
}
}
|