From 374e5e5f5c31942070c3d5d741ed882ef8278382 Mon Sep 17 00:00:00 2001 From: Holt59 Date: Sat, 24 Feb 2018 21:08:52 +0100 Subject: [PATCH] Update javadoc for graph package. --- src/main/org/insa/graph/Arc.java | 30 ++++++-------------- src/main/org/insa/graph/Graph.java | 6 ++-- src/main/org/insa/graph/Node.java | 10 +++++++ src/main/org/insa/graph/Point.java | 5 ++++ src/main/org/insa/graph/RoadInformation.java | 24 ++++++++++++++-- 5 files changed, 48 insertions(+), 27 deletions(-) diff --git a/src/main/org/insa/graph/Arc.java b/src/main/org/insa/graph/Arc.java index f8fe1a9..3bbece3 100644 --- a/src/main/org/insa/graph/Arc.java +++ b/src/main/org/insa/graph/Arc.java @@ -19,25 +19,13 @@ public class Arc { private final ArrayList points; /** - * @param dest - * @param length - * @param roadInformation - * @param points - */ - public Arc(Node origin, Node dest, int length, RoadInformation roadInformation) { - this.origin = origin; - this.destination = dest; - this.length = length; - this.info = roadInformation; - this.points = new ArrayList(); - origin.addSuccessor(this); - } - - /** - * @param dest - * @param length - * @param roadInformation - * @param points + * Create a new arc and automatically link it with the given origin. + * + * @param origin Origin of this arc. + * @param dest Destination of this arc. + * @param length Length of this arc (in meters). + * @param roadInformation Road information for this arc. + * @param points Points representing this arc. */ public Arc(Node origin, Node dest, int length, RoadInformation roadInformation, ArrayList points) { this.origin = origin; @@ -84,9 +72,7 @@ public class Arc { } /** - * @return Points representing segments of this arc. This function may return an - * empty ArrayList if the segments are stored in the reversed arc (for - * two-ways road). + * @return Points representing segments of this arc. */ public List getPoints() { return Collections.unmodifiableList(points); diff --git a/src/main/org/insa/graph/Graph.java b/src/main/org/insa/graph/Graph.java index 8d25713..748eed2 100644 --- a/src/main/org/insa/graph/Graph.java +++ b/src/main/org/insa/graph/Graph.java @@ -13,8 +13,8 @@ public class Graph { private final ArrayList nodes; /** - * @param mapId - * @param nodes + * @param mapId ID of this graph. + * @param nodes List of nodes for this graph. */ public Graph(int mapId, ArrayList nodes) { this.mapId = mapId; @@ -22,7 +22,7 @@ public class Graph { } /** - * @return Nodes of this graph. + * @return Immutable list of nodes of this graph. */ public List getNodes() { return Collections.unmodifiableList(nodes); diff --git a/src/main/org/insa/graph/Node.java b/src/main/org/insa/graph/Node.java index 895442c..6a93bdc 100644 --- a/src/main/org/insa/graph/Node.java +++ b/src/main/org/insa/graph/Node.java @@ -57,6 +57,11 @@ public class Node implements Comparable { return point; } + /* + * (non-Javadoc) + * + * @see java.lang.Object#equals(java.lang.Object) + */ @Override public boolean equals(Object other) { if (other instanceof Node) { @@ -65,6 +70,11 @@ public class Node implements Comparable { return false; } + /* + * (non-Javadoc) + * + * @see java.lang.Comparable#compareTo(java.lang.Object) + */ @Override public int compareTo(Node other) { return Integer.compare(getId(), other.getId()); diff --git a/src/main/org/insa/graph/Point.java b/src/main/org/insa/graph/Point.java index 8341a80..3ea4fb4 100644 --- a/src/main/org/insa/graph/Point.java +++ b/src/main/org/insa/graph/Point.java @@ -61,6 +61,11 @@ public class Point { return distance(this, target); } + /* + * (non-Javadoc) + * + * @see java.lang.Object#toString() + */ @Override public String toString() { return String.format("Point(%f, %f)", getLongitude(), getLatitude()); diff --git a/src/main/org/insa/graph/RoadInformation.java b/src/main/org/insa/graph/RoadInformation.java index 580c2ff..c68e14a 100644 --- a/src/main/org/insa/graph/RoadInformation.java +++ b/src/main/org/insa/graph/RoadInformation.java @@ -10,7 +10,22 @@ public class RoadInformation { * Road type. */ public enum RoadType { - MOTORWAY, TRUNK, PRIMARY, SECONDARY, MOTORWAY_LINK, TRUNK_LINK, PRIMARY_LINK, SECONDARY_LINK, TERTIARY, RESIDENTIAL, UNCLASSIFIED, ROAD, LIVING_STREET, SERVICE, ROUNDABOUT, COASTLINE + MOTORWAY, + TRUNK, + PRIMARY, + SECONDARY, + MOTORWAY_LINK, + TRUNK_LINK, + PRIMARY_LINK, + SECONDARY_LINK, + TERTIARY, + RESIDENTIAL, + UNCLASSIFIED, + ROAD, + LIVING_STREET, + SERVICE, + ROUNDABOUT, + COASTLINE } // Type of the road (see above). @@ -47,7 +62,7 @@ public class RoadInformation { } /** - * @return Maximum speed for this road (in km/h). + * @return Maximum speed for this road (in kmph). */ public int getMaximumSpeed() { return maxSpeed; @@ -60,6 +75,11 @@ public class RoadInformation { return name; } + /* + * (non-Javadoc) + * + * @see java.lang.Object#toString() + */ @Override public String toString() { String typeAsString = "road";