diff --git a/src/main/java/it/unibz/inf/isochrone/algorithm/Isochrone.java b/src/main/java/it/unibz/inf/isochrone/algorithm/Isochrone.java index cf96a1f416a8a8cce6253871d362fb50583618fd..dc4e4760cb7c56e7775da70ece04f706382d99d9 100644 --- a/src/main/java/it/unibz/inf/isochrone/algorithm/Isochrone.java +++ b/src/main/java/it/unibz/inf/isochrone/algorithm/Isochrone.java @@ -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); } } diff --git a/src/test/java/it/unibz/inf/isochrone/network/ReachabilityTest.java b/src/test/java/it/unibz/inf/isochrone/network/ReachabilityTest.java index c9ffeb70ef75bd20b21fe21ef17c8b7f974e8acf..245facdf0f761af5508133b813ca2eb39dcbfe32 100644 --- a/src/test/java/it/unibz/inf/isochrone/network/ReachabilityTest.java +++ b/src/test/java/it/unibz/inf/isochrone/network/ReachabilityTest.java @@ -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"); } }