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" /> <arg line="install.sh" />
</exec> </exec>
</target> </target>
<target name="forge-clean-install" depends="forge-clean, forge-install" />
<target name="clean"> <target name="clean">
<delete dir="${build.base_location}/temp" /> <delete dir="${build.base_location}/temp" />

View file

@ -8,7 +8,7 @@ import java.util.TreeSet;
import com.google.common.collect.ImmutableList; 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>>>(); 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; 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 float weight;
public final T target; public final T target;
public EdgeTraversalStatus edgeTraversalStatus;
public WeightedEdge(T target) { public WeightedEdge(T target) {
@ -14,6 +17,7 @@ public class WeightedEdge<T> implements Comparable<WeightedEdge<T>> {
this.weight = weight; this.weight = weight;
this.target = target; this.target = target;
this.edgeTraversalStatus = EdgeTraversalStatus.UNDISCOVERED;
} }
@Override @Override
@ -37,7 +41,7 @@ public class WeightedEdge<T> implements Comparable<WeightedEdge<T>> {
if (weightedEdge instanceof WeightedEdge) { if (weightedEdge instanceof WeightedEdge) {
if (Float.compare(this.weight, weightedEdge.weight) == 0) { if (Float.compare(this.weight, weightedEdge.weight) == 0) {
return (this.target.hashCode() - weightedEdge.target.hashCode()); return this.target.compareTo(weightedEdge.target);
} }
else { else {
return Float.compare(this.weight, weightedEdge.weight); return Float.compare(this.weight, weightedEdge.weight);