summaryrefslogtreecommitdiff
path: root/BJC-Utils2/src/main/java/bjc/utils/graph/Edge.java
diff options
context:
space:
mode:
authorbculkin2442 <bjculkin@mix.wvu.edu>2016-02-21 15:41:54 -0500
committerbculkin2442 <bjculkin@mix.wvu.edu>2016-02-21 15:41:54 -0500
commiteb30c23bb03579bf839189ab0d2ad172d5b07766 (patch)
tree332c7f409a98e5863bcaf27705f4527e05e85c19 /BJC-Utils2/src/main/java/bjc/utils/graph/Edge.java
parent99e79bca7c1fe3c43ca2ec67e36b8e323c5f7107 (diff)
Commenting of various things and minor refactoring
Diffstat (limited to 'BJC-Utils2/src/main/java/bjc/utils/graph/Edge.java')
-rw-r--r--BJC-Utils2/src/main/java/bjc/utils/graph/Edge.java51
1 files changed, 46 insertions, 5 deletions
diff --git a/BJC-Utils2/src/main/java/bjc/utils/graph/Edge.java b/BJC-Utils2/src/main/java/bjc/utils/graph/Edge.java
index 9fb20c0..cf0764b 100644
--- a/BJC-Utils2/src/main/java/bjc/utils/graph/Edge.java
+++ b/BJC-Utils2/src/main/java/bjc/utils/graph/Edge.java
@@ -1,27 +1,68 @@
package bjc.utils.graph;
+/**
+ * An edge in a weighted graph
+ *
+ * @author ben
+ *
+ * @param <T>
+ * The type of the nodes in the graph
+ */
public class Edge<T> {
- private final T source, target;
+ /**
+ * The distance from initial to terminal node
+ */
private final int distance;
+ /**
+ * The initial and terminal nodes of this edge
+ */
+ private final T source, target;
+
+ /**
+ * Create a new edge with set parameters
+ *
+ * @param node1
+ * The initial node of the edge
+ * @param node2
+ * The terminal node of the edge
+ * @param distance
+ * The distance between initial and terminal edge
+ */
public Edge(T node1, T node2, int distance) {
this.source = node1;
this.target = node2;
this.distance = distance;
}
+ /**
+ * Get the distance in this edge
+ *
+ * @return The distance between the initial and terminal nodes of this
+ * edge
+ */
+ public int getDistance() {
+ return distance;
+ }
+
+ /**
+ * Get the initial node of an edge
+ *
+ * @return The initial node of this edge
+ */
public T getSource() {
return source;
}
+ /**
+ * Get the target node of an edge
+ *
+ * @return The target node of this edge
+ */
public T getTarget() {
return target;
}
- public int getDistance() {
- return distance;
- }
-
@Override
public String toString() {
return " first vertex " + source + " to vertex " + target