From d9935fbbf86524a2d47fa1b59c51f6d5909e5da2 Mon Sep 17 00:00:00 2001 From: Nikolaus Krismer <nikolaus.krismer@uibk.ac.at> Date: Tue, 1 Jul 2014 19:03:32 +0200 Subject: [PATCH] fixed some javadoc issues --- .../it/unibz/inf/isochrone/db/Database.java | 13 +++++-- .../it/unibz/inf/isochrone/network/Link.java | 36 ++++++++++++------- .../it/unibz/inf/isochrone/util/Query.java | 7 ++++ .../inf/isochrone/util/ResourceHelper.java | 3 +- 4 files changed, 42 insertions(+), 17 deletions(-) diff --git a/src/main/java/it/unibz/inf/isochrone/db/Database.java b/src/main/java/it/unibz/inf/isochrone/db/Database.java index 1973e88a..7f2a123b 100644 --- a/src/main/java/it/unibz/inf/isochrone/db/Database.java +++ b/src/main/java/it/unibz/inf/isochrone/db/Database.java @@ -60,7 +60,9 @@ public class Database { protected Mode mode; protected boolean isIncoming; private Map<String, PreparedStatement> pstmtsCacheMap; - private Connection connection; /** The connection the the database. It is lazy-loaded by {@link #getPstmt(String)} method. */ + /** The connection the the database. It is lazy-loaded by {@link #getPstmt(String)} method. */ + private Connection connection; + // Constructor public Database(final ConfigDataset config, final Mode mode, final Direction direction) { @@ -493,7 +495,12 @@ public class Database { } /** - * Loads the links in a circle from the database (for better explanation see the MrneX algorithm). + * Loads the links in a circle from the database (for better explanation see the {@link it.unibz.inf.isochrone.algorithm.MrneX} algorithm). + * + * @param node the node for which the links will be loaded + * @param intersections if set then nodes will be loaded using st_difference by using the nodes given + * @param nodes the nodes belonging to the links will be added to this map (if not already in there) + * @param adjList the links will be connected to the links here (or added to this collection if not already in there) */ public void loadLinksFromIER(final Node node, final Collection<Node> intersections, final Map<Integer, Node> nodes, final Map<Integer, Collection<Link>> adjList) { PreparedStatement stmt = null; @@ -502,7 +509,7 @@ public class Database { final Point g = node.getCoordinates(); final String pointString = "POINT( " + g.getX() + " " + g.getY() + ")"; try { - if (intersections.isEmpty()) { + if (intersections == null || intersections.isEmpty()) { stmt = getPstmt(queryLoadLinksFromIER); // CHECKSTYLE:OFF MagicNumber stmt.setString(1, pointString); diff --git a/src/main/java/it/unibz/inf/isochrone/network/Link.java b/src/main/java/it/unibz/inf/isochrone/network/Link.java index 902bfde7..a9d15add 100644 --- a/src/main/java/it/unibz/inf/isochrone/network/Link.java +++ b/src/main/java/it/unibz/inf/isochrone/network/Link.java @@ -10,33 +10,43 @@ public class Link { private final int id; private final int startNode; private final int endNode; + private final boolean continuous; private double length; private double endOffset = Double.MIN_VALUE; private double startOffset = Double.MIN_VALUE; - private int route; - private final boolean continuous; - /** * Creates a continuous link. + * + * @param id the id of the created link + * @param startNodeId the id of the node from which the link starts + * @param endNodeId the id of the node to which the link connects + * @param length the costs of the link (also called length) */ - public Link(final int linkId, final int startNodeId, final int endNodeId, final double linkCost) { - id = linkId; - startNode = startNodeId; - endNode = endNodeId; - length = linkCost; + public Link(final int id, final int startNodeId, final int endNodeId, final double length) { + this.id = id; + this.startNode = startNodeId; + this.endNode = endNodeId; + this.length = length; + continuous = true; } /** * Creates a discrete link. + * + * @param id the id of the created link + * @param startNodeId the id of the node from which the link starts + * @param endNodeId the id of the node to which the link connects + * @param routeId the id of the route this link belongs to */ - public Link(final int linkId, final int startNodeId, final int endNodeId, final int routeId) { - id = linkId; - startNode = startNodeId; - endNode = endNodeId; - route = routeId; + public Link(final int id, final int startNodeId, final int endNodeId, final int routeId) { + this.id = id; + this.startNode = startNodeId; + this.endNode = endNodeId; + this.route = routeId; + continuous = false; } diff --git a/src/main/java/it/unibz/inf/isochrone/util/Query.java b/src/main/java/it/unibz/inf/isochrone/util/Query.java index 9ef77d86..628e9a14 100644 --- a/src/main/java/it/unibz/inf/isochrone/util/Query.java +++ b/src/main/java/it/unibz/inf/isochrone/util/Query.java @@ -33,6 +33,13 @@ public class Query { /** * Construct a query object with every field except the nodes and * locations. Remember to set them afterward!! + * + * @param dir the direction of this query (incoming or outgoing) + * @param walkingSpeed the speed of walking + * @param duration the duration (in seconds) + * @param time the time to start/end in the queryNode (for incoming direction its the toTime, fromTime otherwise) + * @param expireNodes flag indicating if the query should expire unused nodes + * @param mode the mode the query is calculated in (unimodal or multimodal) */ public Query(final Direction dir, final double walkingSpeed, final long duration, final Calendar time, final boolean expireNodes, final Mode mode) { startNodes = new HashSet<>(); diff --git a/src/main/java/it/unibz/inf/isochrone/util/ResourceHelper.java b/src/main/java/it/unibz/inf/isochrone/util/ResourceHelper.java index a6b98a92..d390e7b2 100644 --- a/src/main/java/it/unibz/inf/isochrone/util/ResourceHelper.java +++ b/src/main/java/it/unibz/inf/isochrone/util/ResourceHelper.java @@ -20,6 +20,7 @@ public final class ResourceHelper { /** * Gets all resources matching the given pattern from the path elements given. * + * @param classPathElements the resource elements to search for files in * @param fileNamePattern the pattern to match against * @return the resources in the order they are found * @throws IOException if an I/O error occurs @@ -37,7 +38,7 @@ public final class ResourceHelper { public static Set<String> findFilesInResources(final String[] pathElements, final Pattern fileNamePattern) throws IOException { final Set<String> result = new HashSet<String>(); - for (String element : pathElements) { + for (final String element : pathElements) { final File newFile = new File(element); if (newFile.isDirectory()) { result.addAll(findResourceInDirectory(newFile, fileNamePattern)); -- GitLab