-
Notifications
You must be signed in to change notification settings - Fork 376
/
ConstantWeighting.java
81 lines (65 loc) 路 2 KB
/
ConstantWeighting.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
70
71
72
73
74
75
76
77
78
79
80
81
package org.heigit.ors.routing.graphhopper.extensions.weighting;
import com.graphhopper.routing.util.FlagEncoder;
import com.graphhopper.routing.util.SpeedCalculator;
import com.graphhopper.routing.weighting.Weighting;
import com.graphhopper.util.EdgeIteratorState;
public class ConstantWeighting implements Weighting {
private final double weight;
private final long millis;
public ConstantWeighting(double weight, long millis) {
this.weight = weight;
this.millis = millis;
}
@Override
public double getMinWeight(double distance) {
return weight;
}
@Override
public double calcEdgeWeight(EdgeIteratorState edgeIteratorState, boolean reverse) {
return weight;
}
@Override
public double calcEdgeWeight(EdgeIteratorState edgeIteratorState, boolean reverse, long edgeEnterTime) {
return calcEdgeWeight(edgeIteratorState, reverse);
}
@Override
public long calcEdgeMillis(EdgeIteratorState edgeIteratorState, boolean reverse) {
return millis;
}
@Override
public long calcEdgeMillis(EdgeIteratorState edgeIteratorState, boolean reverse, long edgeEnterTime) {
return calcEdgeMillis(edgeIteratorState, reverse);
}
@Override
public double calcTurnWeight(int inEdge, int viaNode, int outEdge) {
return weight;
}
@Override
public long calcTurnMillis(int inEdge, int viaNode, int outEdge) {
return millis;
}
@Override
public boolean hasTurnCosts() {
return false;
}
@Override
public FlagEncoder getFlagEncoder() {
return null;
}
@Override
public String getName() {
return "constant(" + weight + ")";
}
@Override
public boolean isTimeDependent() {
return false;
}
@Override
public SpeedCalculator getSpeedCalculator() {
return null;
}
@Override
public void setSpeedCalculator(SpeedCalculator speedCalculator) {
throw new UnsupportedOperationException();
}
}