Update javadoc for graph package.
This commit is contained in:
parent
adbb1f7e61
commit
374e5e5f5c
@ -19,25 +19,13 @@ public class Arc {
|
|||||||
private final ArrayList<Point> points;
|
private final ArrayList<Point> points;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param dest
|
* Create a new arc and automatically link it with the given origin.
|
||||||
* @param length
|
*
|
||||||
* @param roadInformation
|
* @param origin Origin of this arc.
|
||||||
* @param points
|
* @param dest Destination of this arc.
|
||||||
*/
|
* @param length Length of this arc (in meters).
|
||||||
public Arc(Node origin, Node dest, int length, RoadInformation roadInformation) {
|
* @param roadInformation Road information for this arc.
|
||||||
this.origin = origin;
|
* @param points Points representing this arc.
|
||||||
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
|
|
||||||
*/
|
*/
|
||||||
public Arc(Node origin, Node dest, int length, RoadInformation roadInformation, ArrayList<Point> points) {
|
public Arc(Node origin, Node dest, int length, RoadInformation roadInformation, ArrayList<Point> points) {
|
||||||
this.origin = origin;
|
this.origin = origin;
|
||||||
@ -84,9 +72,7 @@ public class Arc {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Points representing segments of this arc. This function may return an
|
* @return Points representing segments of this arc.
|
||||||
* empty ArrayList if the segments are stored in the reversed arc (for
|
|
||||||
* two-ways road).
|
|
||||||
*/
|
*/
|
||||||
public List<Point> getPoints() {
|
public List<Point> getPoints() {
|
||||||
return Collections.unmodifiableList(points);
|
return Collections.unmodifiableList(points);
|
||||||
|
@ -13,8 +13,8 @@ public class Graph {
|
|||||||
private final ArrayList<Node> nodes;
|
private final ArrayList<Node> nodes;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param mapId
|
* @param mapId ID of this graph.
|
||||||
* @param nodes
|
* @param nodes List of nodes for this graph.
|
||||||
*/
|
*/
|
||||||
public Graph(int mapId, ArrayList<Node> nodes) {
|
public Graph(int mapId, ArrayList<Node> nodes) {
|
||||||
this.mapId = mapId;
|
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() {
|
public List<Node> getNodes() {
|
||||||
return Collections.unmodifiableList(nodes);
|
return Collections.unmodifiableList(nodes);
|
||||||
|
@ -57,6 +57,11 @@ public class Node implements Comparable<Node> {
|
|||||||
return point;
|
return point;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see java.lang.Object#equals(java.lang.Object)
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object other) {
|
public boolean equals(Object other) {
|
||||||
if (other instanceof Node) {
|
if (other instanceof Node) {
|
||||||
@ -65,6 +70,11 @@ public class Node implements Comparable<Node> {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see java.lang.Comparable#compareTo(java.lang.Object)
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int compareTo(Node other) {
|
public int compareTo(Node other) {
|
||||||
return Integer.compare(getId(), other.getId());
|
return Integer.compare(getId(), other.getId());
|
||||||
|
@ -61,6 +61,11 @@ public class Point {
|
|||||||
return distance(this, target);
|
return distance(this, target);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see java.lang.Object#toString()
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return String.format("Point(%f, %f)", getLongitude(), getLatitude());
|
return String.format("Point(%f, %f)", getLongitude(), getLatitude());
|
||||||
|
@ -10,7 +10,22 @@ public class RoadInformation {
|
|||||||
* Road type.
|
* Road type.
|
||||||
*/
|
*/
|
||||||
public enum RoadType {
|
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).
|
// 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() {
|
public int getMaximumSpeed() {
|
||||||
return maxSpeed;
|
return maxSpeed;
|
||||||
@ -60,6 +75,11 @@ public class RoadInformation {
|
|||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see java.lang.Object#toString()
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
String typeAsString = "road";
|
String typeAsString = "road";
|
||||||
|
Loading…
Reference in New Issue
Block a user