Skip to content
Snippets Groups Projects
Commit b985be52 authored by User expired's avatar User expired
Browse files

fixed a problem in isochrone calculation with link length

parent 1a6f3e96
No related branches found
No related tags found
No related merge requests found
......@@ -32,7 +32,6 @@ import java.util.Set;
* algorithms which define the loading of the data from the database.
*/
public abstract class Isochrone {
private static final double COMPARE_PRECISION = 0.0000001d;
private final Collection<Integer> dateCodes;
private final AbstractQueue<Node> nodeQueue;
private final long qDuration;
......@@ -431,8 +430,9 @@ public abstract class Isochrone {
// Private static methods
private static <T extends IOutput> void addLinks(final T output, final Collection<Link> links) {
final Double min = Double.MIN_VALUE;
for (final Link link : links) {
if (link.isContinuous() && Math.abs(link.getStartOffset() - Double.MIN_VALUE) < COMPARE_PRECISION) {
if (link.isContinuous() && !min.equals(link.getStartOffset())) {
output.addLink(link);
}
}
......
......@@ -42,12 +42,13 @@ public class ReachabilityTest {
}
@Test
public void testBzBusStation15() {
public void testBzBusStationNode15() {
final int nodeIdToCheck = 5117; // bus station id = 5117; Defregger Str./Fagenstraße (reachable by bus route 1)
LOGGER.info("Checking nodes from FUB (15min isncoming isochrone)");
final AlgorithmResult result = AlgorithmHelper.run(MineX.class, PARAM_LOCAL, true);
final Collection<Node> resultNodes = result.getOutput().getNodes();
LOGGER.info(" - found " + resultNodes.size() + " reachable nodes");
boolean foundNode = false;
for (final Node node : resultNodes) {
......@@ -57,7 +58,27 @@ public class ReachabilityTest {
}
}
Assert.assertTrue(foundNode, "Expected node not found in 15min incoming isochrone to FUB");
Assert.assertTrue(foundNode, "Expected node \"" + nodeIdToCheck + "\" not in 15min incoming isochrone to FUB");
}
@Test
public void testBzBusStationLink15() {
final int nodeIdToCheck = 5117; // bus station id = 5117; Defregger Str./Fagenstraße (reachable by bus route 1)
LOGGER.info("Checking nodes from FUB (15min isncoming isochrone)");
final AlgorithmResult result = AlgorithmHelper.run(MineX.class, PARAM_LOCAL, true);
final Collection<Link> resultLinks = result.getOutput().getLinks().values();
LOGGER.info(" - found " + resultLinks.size() + " links");
boolean foundLink = false;
for (final Link link : resultLinks) {
if (link.getEndNode() == nodeIdToCheck) {
foundLink = true;
break;
}
}
Assert.assertTrue(foundLink, "Expected link to node \"" + nodeIdToCheck + "\" not in 15min incoming isochrone to FUB");
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment