Commit 0fcbf535 authored by Tobias Meuser's avatar Tobias Meuser
Browse files

Updated isJammed() function

parent e67cede5
......@@ -79,7 +79,7 @@ public class JamProperty implements RoadProperty {
}
public boolean isJammed() {
return _jammed;
return JamProperty.isJammed(getEdge(), getAverageSpeed());
}
public double getAverageSpeed() {
......@@ -95,4 +95,15 @@ public class JamProperty implements RoadProperty {
return new JamProperty(_location, _edge, false, -1);
}
public static boolean isJammed(RoadNetworkEdge pEdge, double pSpeed) {
if (pEdge != null) {
double originalMaxSpeed = pEdge.getOriginalMaxSpeed();
if (pSpeed < originalMaxSpeed * 0.675) {
return true;
}
}
return false;
}
}
......@@ -176,17 +176,7 @@ public class VectoralJamProperty extends NumericVectoralProperty {
* @return
*/
public boolean isJammed() {
if (getEdge() != null) {
double originalMaxSpeed = getEdge().getOriginalMaxSpeed();
double speed = getExpectation();
if (speed < (((int) (originalMaxSpeed * 0.375 / VectoralJamProperty.SCALING))
* VectoralJamProperty.SCALING)) {
return true;
}
}
return false;
return JamProperty.isJammed(getEdge(), getExpectation());
}
@Override
......
......@@ -260,4 +260,13 @@ public class RoadNetworkEdge {
return laneShapes;
}
public boolean isJammed() {
for (RoadProperty roadProperty : _activeProperties) {
if (roadProperty instanceof JamProperty) {
return ((JamProperty) roadProperty).isJammed();
}
}
return false;
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment