diff --git a/build.xml b/build.xml index ccf087fb..f02b833c 100644 --- a/build.xml +++ b/build.xml @@ -43,6 +43,8 @@ + + diff --git a/common/com/pahimar/ee3/emc/graph/WeightedDirectedGraph.java b/common/com/pahimar/ee3/emc/graph/WeightedDirectedGraph.java index 34c269ce..b2c93dd5 100644 --- a/common/com/pahimar/ee3/emc/graph/WeightedDirectedGraph.java +++ b/common/com/pahimar/ee3/emc/graph/WeightedDirectedGraph.java @@ -8,7 +8,7 @@ import java.util.TreeSet; import com.google.common.collect.ImmutableList; -public class WeightedDirectedGraph implements Iterable { +public class WeightedDirectedGraph> implements Iterable { private final Map>> graph = new HashMap>>(); diff --git a/common/com/pahimar/ee3/emc/graph/WeightedEdge.java b/common/com/pahimar/ee3/emc/graph/WeightedEdge.java index cc237ed9..09975a6d 100644 --- a/common/com/pahimar/ee3/emc/graph/WeightedEdge.java +++ b/common/com/pahimar/ee3/emc/graph/WeightedEdge.java @@ -1,9 +1,12 @@ package com.pahimar.ee3.emc.graph; -public class WeightedEdge implements Comparable> { +public class WeightedEdge> implements Comparable> { + public enum EdgeTraversalStatus { UNDISCOVERED, DISCOVERY_EDGE, BACK_EDGE } + public final float weight; public final T target; + public EdgeTraversalStatus edgeTraversalStatus; public WeightedEdge(T target) { @@ -14,6 +17,7 @@ public class WeightedEdge implements Comparable> { this.weight = weight; this.target = target; + this.edgeTraversalStatus = EdgeTraversalStatus.UNDISCOVERED; } @Override @@ -37,7 +41,7 @@ public class WeightedEdge implements Comparable> { if (weightedEdge instanceof WeightedEdge) { if (Float.compare(this.weight, weightedEdge.weight) == 0) { - return (this.target.hashCode() - weightedEdge.target.hashCode()); + return this.target.compareTo(weightedEdge.target); } else { return Float.compare(this.weight, weightedEdge.weight);