[clean] Apply formatting and add formatter configuration.

This commit is contained in:
Mikael Capelle
2021-07-08 13:53:33 +02:00
committed by Mikael CAPELLE
parent 2f936d44ec
commit 730cda6426
86 changed files with 1460 additions and 1214 deletions

View File

@@ -8,16 +8,13 @@ import java.util.List;
* <p>
* Class representing a Node in a {@link Graph}.
* </p>
*
* <p>
* This class holds information regarding nodes in the graph together with the
* successors associated to the nodes.
* </p>
*
* <p>
* Nodes are comparable based on their ID.
* </p>
*
*/
public final class Node implements Comparable<Node> {
@@ -26,19 +23,17 @@ public final class Node implements Comparable<Node> {
* Link the two given nodes with one or two arcs (depending on roadInformation),
* with the given attributes.
* </p>
*
* <p>
* If {@code roadInformation.isOneWay()} is {@code true}, only a forward arc is
* created (origin to destination) and added to origin. Otherwise, a
* corresponding backward arc is created and add to destination.
* created (origin to destination) and added to origin. Otherwise, a corresponding
* backward arc is created and add to destination.
* </p>
*
* @param origin Origin of the arc.
* @param destination Destination of the arc.
* @param length Length of the arc.
*
* @param origin Origin of the arc.
* @param destination Destination of the arc.
* @param length Length of the arc.
* @param roadInformation Information corresponding to the arc.
* @param points Points for the arc.
*
* @param points Points for the arc.
* @return The newly created forward arc (origin to destination).
*/
public static Arc linkNodes(Node origin, Node destination, float length,
@@ -51,12 +46,14 @@ public final class Node implements Comparable<Node> {
else {
final Arc d2o;
if (origin.getId() < destination.getId()) {
arc = new ArcForward(origin, destination, length, roadInformation, points);
arc = new ArcForward(origin, destination, length, roadInformation,
points);
d2o = new ArcBackward(arc);
}
else {
Collections.reverse(points);
d2o = new ArcForward(destination, origin, length, roadInformation, points);
d2o = new ArcForward(destination, origin, length, roadInformation,
points);
arc = new ArcBackward(d2o);
}
origin.addSuccessor(arc);
@@ -77,8 +74,8 @@ public final class Node implements Comparable<Node> {
/**
* Create a new Node with the given ID corresponding to the given Point with an
* empty list of successors.
*
* @param id ID of the node.
*
* @param id ID of the node.
* @param point Position of the node.
*/
public Node(int id, Point point) {
@@ -89,7 +86,7 @@ public final class Node implements Comparable<Node> {
/**
* Add a successor to this node.
*
*
* @param arc Arc to the successor.
*/
protected void addSuccessor(Arc arc) {
@@ -119,7 +116,6 @@ public final class Node implements Comparable<Node> {
/**
* @return List of successors of this node (unmodifiable list).
*
* @see Collections#unmodifiableList(List)
*/
public List<Arc> getSuccessors() {
@@ -146,9 +142,8 @@ public final class Node implements Comparable<Node> {
/**
* Compare the ID of this node with the ID of the given node.
*
*
* @param other Node to compare this node with.
*
* @see java.lang.Comparable#compareTo(java.lang.Object)
*/
@Override