Added a clean forge install option to the build script, and some more attributes for the graph infrastructure

This commit is contained in:
pahimar 2013-09-16 19:59:40 -04:00
parent ba142c81c3
commit 2614792aff
3 changed files with 9 additions and 3 deletions

View file

@ -43,6 +43,8 @@
<arg line="install.sh" />
</exec>
</target>
<target name="forge-clean-install" depends="forge-clean, forge-install" />
<target name="clean">
<delete dir="${build.base_location}/temp" />

View file

@ -8,7 +8,7 @@ import java.util.TreeSet;
import com.google.common.collect.ImmutableList;
public class WeightedDirectedGraph<T> implements Iterable<T> {
public class WeightedDirectedGraph<T extends Comparable<T>> implements Iterable<T> {
private final Map<T, SortedSet<WeightedEdge<T>>> graph = new HashMap<T, SortedSet<WeightedEdge<T>>>();

View file

@ -1,9 +1,12 @@
package com.pahimar.ee3.emc.graph;
public class WeightedEdge<T> implements Comparable<WeightedEdge<T>> {
public class WeightedEdge<T extends Comparable<T>> implements Comparable<WeightedEdge<T>> {
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<T> implements Comparable<WeightedEdge<T>> {
this.weight = weight;
this.target = target;
this.edgeTraversalStatus = EdgeTraversalStatus.UNDISCOVERED;
}
@Override
@ -37,7 +41,7 @@ public class WeightedEdge<T> implements Comparable<WeightedEdge<T>> {
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);