summaryrefslogtreecommitdiff
path: root/base/src/main/java/bjc/utils/graph/Edge.java
diff options
context:
space:
mode:
authorBen Culkin <scorpress@gmail.com>2020-11-12 20:05:01 -0500
committerBen Culkin <scorpress@gmail.com>2020-11-12 20:05:01 -0500
commit6dcd129a10af0034b38bfe843d223c4593deee09 (patch)
treee27cf2574a10da36d9a737e1fef48da8e5681da8 /base/src/main/java/bjc/utils/graph/Edge.java
parentc41cfde634d70c3a50adf3979cc5239e5ae52e73 (diff)
Cleanup part 2
Diffstat (limited to 'base/src/main/java/bjc/utils/graph/Edge.java')
-rw-r--r--base/src/main/java/bjc/utils/graph/Edge.java33
1 files changed, 13 insertions, 20 deletions
diff --git a/base/src/main/java/bjc/utils/graph/Edge.java b/base/src/main/java/bjc/utils/graph/Edge.java
index fe3d891..b48fcd0 100644
--- a/base/src/main/java/bjc/utils/graph/Edge.java
+++ b/base/src/main/java/bjc/utils/graph/Edge.java
@@ -28,11 +28,8 @@ public class Edge<T> {
* The distance between initial and terminal edge.
*/
public Edge(final T initial, final T terminal, final int distance) {
- if (initial == null) {
- throw new NullPointerException("Initial node must not be null");
- } else if (terminal == null) {
- throw new NullPointerException("Terminal node must not be null");
- }
+ if (initial == null) throw new NullPointerException("Initial node must not be null");
+ else if (terminal == null) throw new NullPointerException("Terminal node must not be null");
this.source = initial;
this.target = terminal;
@@ -41,27 +38,23 @@ public class Edge<T> {
@Override
public boolean equals(final Object obj) {
- if (this == obj)
- return true;
- else if (obj == null)
- return false;
- else if (getClass() != obj.getClass())
- return false;
+ if (this == obj) return true;
+ else if (obj == null) return false;
+ 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))
+ } else if (target == null) {
+ if (other.target != null) return false;
+ } else if (!target.equals(other.target)) {
return false;
+ }
return true;
}