summaryrefslogtreecommitdiff
path: root/base/src/main/java/bjc/utils/graph/Edge.java
diff options
context:
space:
mode:
Diffstat (limited to 'base/src/main/java/bjc/utils/graph/Edge.java')
-rw-r--r--base/src/main/java/bjc/utils/graph/Edge.java49
1 files changed, 23 insertions, 26 deletions
diff --git a/base/src/main/java/bjc/utils/graph/Edge.java b/base/src/main/java/bjc/utils/graph/Edge.java
index 9236464..e7e7b36 100644
--- a/base/src/main/java/bjc/utils/graph/Edge.java
+++ b/base/src/main/java/bjc/utils/graph/Edge.java
@@ -6,10 +6,10 @@ package bjc.utils.graph;
* @author ben
*
* @param <T>
- * The type of the nodes in the graph.
+ * The type of the nodes in the graph.
*/
public class Edge<T> {
- /* The distance from initial to terminal node. */
+ /* The distance from initial to terminal node. */
private final int distance;
/* The initial and terminal nodes of this edge. */
@@ -19,18 +19,18 @@ public class Edge<T> {
* Create a new edge with set parameters.
*
* @param initial
- * The initial node of the edge.
+ * The initial node of the edge.
*
* @param terminal
- * The terminal node of the edge.
+ * The terminal node of the edge.
*
* @param distance
- * The distance between initial and terminal edge.
+ * The distance between initial and terminal edge.
*/
public Edge(final T initial, final T terminal, final int distance) {
- if (initial == null) {
+ if(initial == null) {
throw new NullPointerException("Initial node must not be null");
- } else if (terminal == null) {
+ } else if(terminal == null) {
throw new NullPointerException("Terminal node must not be null");
}
@@ -41,24 +41,24 @@ public class Edge<T> {
@Override
public boolean equals(final Object obj) {
- if (this == obj)
+ if(this == obj)
return true;
- else if (obj == null)
+ else if(obj == null)
return false;
- else if (getClass() != obj.getClass())
+ else if(getClass() != obj.getClass())
return false;
else {
final Edge<?> other = (Edge<?>) obj;
- if (distance != other.distance)
+ if(distance != other.distance)
return false;
- else if (source == null) {
- if (other.source != null) return false;
- } else if (!source.equals(other.source))
+ else if(source == null) {
+ if(other.source != null) return false;
+ } else if(!source.equals(other.source))
return false;
- else if (target == null) {
- if (other.target != null) return false;
- } else if (!target.equals(other.target)) return false;
+ else if(target == null) {
+ if(other.target != null) return false;
+ } else if(!target.equals(other.target)) return false;
return true;
}
@@ -67,9 +67,8 @@ public class Edge<T> {
/**
* Get the distance in this edge.
*
- * @return
- * The distance between the initial and terminal nodes of this
- * edge.
+ * @return The distance between the initial and terminal nodes of this
+ * edge.
*/
public int getDistance() {
return distance;
@@ -78,8 +77,7 @@ public class Edge<T> {
/**
* Get the initial node of an edge.
*
- * @return
- * The initial node of this edge.
+ * @return The initial node of this edge.
*/
public T getSource() {
return source;
@@ -88,8 +86,7 @@ public class Edge<T> {
/**
* Get the target node of an edge.
*
- * @return
- * The target node of this edge.
+ * @return The target node of this edge.
*/
public T getTarget() {
return target;
@@ -110,8 +107,8 @@ public class Edge<T> {
@Override
public String toString() {
- String msg = String.format("source vertex %s to target vertex %s with distance: %s",
- source, target, distance);
+ String msg = String.format("source vertex %s to target vertex %s with distance: %s", source, target,
+ distance);
return msg;
}