Update javadoc for graph package.

This commit is contained in:
Holt59 2018-02-24 21:08:52 +01:00
parent adbb1f7e61
commit 374e5e5f5c
5 changed files with 48 additions and 27 deletions

View File

@ -19,25 +19,13 @@ public class Arc {
private final ArrayList<Point> 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<Point>();
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<Point> 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<Point> getPoints() {
return Collections.unmodifiableList(points);

View File

@ -13,8 +13,8 @@ public class Graph {
private final ArrayList<Node> nodes;
/**
* @param mapId
* @param nodes
* @param mapId ID of this graph.
* @param nodes List of nodes for this graph.
*/
public Graph(int mapId, ArrayList<Node> 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<Node> getNodes() {
return Collections.unmodifiableList(nodes);

View File

@ -57,6 +57,11 @@ public class Node implements Comparable<Node> {
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<Node> {
return false;
}
/*
* (non-Javadoc)
*
* @see java.lang.Comparable#compareTo(java.lang.Object)
*/
@Override
public int compareTo(Node other) {
return Integer.compare(getId(), other.getId());

View File

@ -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());

View File

@ -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";