Loading src/main/java/graphgen/datastructures/Pair.java +9 −24 Changes for src/main/java/graphgen/datastructures/Pair.java: 9 added lines, 24 removed lines. Original line number Diff line number Diff line Loading @@ -64,32 +64,17 @@ public class Pair<T1, T2> { } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((first == null) ? 0 : first.hashCode()); result = prime * result + ((second == null) ? 0 : second.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) public boolean equals(Object o) { if (this == o) return true; if (obj == null) return false; if (!(obj instanceof Pair)) if (o == null || getClass() != o.getClass()) return false; Pair<?, ?> other = (Pair<?, ?>) obj; if (first == null) { if (other.first != null) return false; } else if (!first.equals(other.first)) return false; if (second == null) { return other.second == null; } else return second.equals(other.second); Pair<?, ?> pair = (Pair<?, ?>) o; return Objects.equals(first, pair.first) && Objects.equals(second, pair.second); } @Override public int hashCode() { return Objects.hash(first, second); } } src/main/java/graphgen/datastructures/SeededRandom.java +11 −0 Changes for src/main/java/graphgen/datastructures/SeededRandom.java: 11 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -84,6 +84,17 @@ public class SeededRandom { return rng.nextDouble(); } /** * Returns a random long value. * * @return the random long value * @throws UnsupportedOperationException if this instance has not yet been seeded */ public long nextLong() { checkSeededStatus(); return rng.nextLong(); } /** * Returns the wrapped random instance. * Loading src/main/java/graphgen/generator/GraphGenerator.java +40 −85 Changes for src/main/java/graphgen/generator/GraphGenerator.java: 40 added lines, 85 removed lines. Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package graphgen.generator; import graphgen.datastructures.Pair; import graphgen.datastructures.SeededRandom; import graphgen.enums.ResourceType; import graphgen.generator.components.StrictComponent; import graphgen.generator.components.edges.EdgeCreator; import graphgen.generator.components.edges.includers.EdgeIncluder; Loading @@ -36,6 +37,7 @@ import graphgen.util.GraphUtils; import graphgen.util.JavaUtils; import modsched.Edge; import java.io.OutputStream; import java.io.PrintStream; import java.util.ArrayList; import java.util.Collection; Loading Loading @@ -84,7 +86,6 @@ public final class GraphGenerator implements StrictComponent { private final SeededRandom rng; private final EdgeInclusionDuplicateChecker edgeChecker; private boolean verbose = false; private PrintStream out = System.out; /** Loading Loading @@ -165,9 +166,7 @@ public final class GraphGenerator implements StrictComponent { */ public Graph<ResourceNode> createGraph(long seed) { if (verbose) { out.println("Creating graph with seed " + seed); } // Reset and clear generation objects. layerCreator.reset(); Loading @@ -186,9 +185,7 @@ public final class GraphGenerator implements StrictComponent { GeneratedLayerStructure layers = layerCreator.createLayerStructure(); if (verbose) { out.println("\tGenerated layer structure: " + layers.toString()); } edgeCreator.addObserver(layers); edgeCreator.addObserver(property); Loading @@ -201,9 +198,17 @@ public final class GraphGenerator implements StrictComponent { Set<ResourceNode> nodes = nodeCreator.createNodes(layers); if (verbose) { out.println("\tGenerated nodes: " + nodes.toString()); out.print("\tResources in use: ["); List<Resource> resourcesUsed = new ArrayList<>(GraphUtils.getResources(nodes, ResourceType.ALL)); for (int i = 0; i < resourcesUsed.size(); i++) { if (i > 0) { out.print(", "); } Resource r = resourcesUsed.get(i); out.print(String.format("(%s, %d, %d)", r.name, r.delay, r.limit)); } out.println("]"); out.println("\tGenerated nodes: " + nodes.toString()); Map<Integer, ResourceNode> nodeTable = new HashMap<>(); nodes.forEach(n -> nodeTable.put(n.getId(), n)); Loading @@ -218,11 +223,9 @@ public final class GraphGenerator implements StrictComponent { edgeCreator ); if (verbose) { out.println("\tLayer structure post property generation: " + layers.toString()); out.println("\tGenerated edges post property generation: " + edgeCreator.edgeView()); out.println("\tGenerating incoming edges."); } nodes.add(SOURCE); nodes.add(SINK); Loading @@ -231,22 +234,16 @@ public final class GraphGenerator implements StrictComponent { generateIncomingEdges(layers, nodes, nodeTable, asapTimes); if (verbose) { out.println("\tGenerating outgoing edges."); } generateOutgoingEdges(layers, nodes, nodeTable, asapTimes); if (verbose) { out.println("\tGenerating optional edges."); } generateOptionalEdges(layers, nodes, nodeTable, asapTimes); verifyASAPTimesMap(edgeCreator.edgeView(), asapTimes); if (verbose) { out.println("\tGenerating remaining backedges."); } generateBackedges(asapTimes); Loading Loading @@ -280,11 +277,11 @@ public final class GraphGenerator implements StrictComponent { for (int i = 0; i < amount; i++) { if (!graphs.add(createGraph(seed)) && verbose) { out.println("Duplicate detected."); if (!graphs.add(createGraph(seed))) { out.println("Duplicate detected (seed: " + seed + ")."); } seed = rng.getRandom().nextLong(); seed = rng.nextLong(); } } else { Loading @@ -298,11 +295,11 @@ public final class GraphGenerator implements StrictComponent { if (!GraphUtils.isGraphIsomorphicToAny(graph, asapTimes, asapTimesMap)) graphs.add(graph); else if (verbose) { out.println("Isomorphism detected."); else { out.println("Isomorphism detected (seed: " + seed + ")."); } seed = rng.getRandom().nextLong(); seed = rng.nextLong(); } } Loading @@ -321,25 +318,26 @@ public final class GraphGenerator implements StrictComponent { } /** * Sets the generator to verbose mode, i.e. that the generation process will be written to the provided print * stream. * Toggles the generator's verbosity. If a print print stream is supplied, the generation process will be written to * it. If <i>out</i> is null, the generation process won't be documented. * <p> * Use <code>new PrintStream(new FileOutputStream(new File(filename))</code> to immediately write to a file.<br> * Use<p>{@code new PrintStream(new FileOutputStream(new File(filename))}<p>to immediately write to a file.<br> * <b>Warning</b>: The resulting file might be excessively large due to the * amount of edges possible in large graphs (O(2*V<sup>2</sup>)). * * @param out the print stream * @param out the print stream used to document the generation process or null to disable any generation output */ public void setVerbose(PrintStream out) { verbose = true; public void setOut(PrintStream out) { if (out == null) { this.out = new PrintStream(new OutputStream() { @Override public void write(int b) { // Do nothing. } }); } else { this.out = out; } /** * Sets the generator to non-verbose mode, i.e. that the generation process won't be documented. */ public void setNonVerbose() { verbose = false; } /** Loading Loading @@ -375,9 +373,7 @@ public final class GraphGenerator implements StrictComponent { if (hasMandatoryIncomingEdge) continue; if (verbose) { out.println("\t\tTrying to generate an incoming edge for node " + dst); } /* * Store source candidates with edge delays whose corresponding edges are Loading @@ -400,9 +396,7 @@ public final class GraphGenerator implements StrictComponent { int delay = edgeCreator.computeEdgeDelay(src, dst); if (verbose) { out.print("\t\t\t" + src + "--" + delay + "-->" + dst + ": "); } if (isEdgePossible(src, dst, delay)) { if (edgeIncluder.includeEdge(new Edge<>(src, dst, delay, 0))) { Loading @@ -414,14 +408,11 @@ public final class GraphGenerator implements StrictComponent { possibleCandidates.add(Pair.of(src, delay)); if (verbose) { out.println("optimal."); } } else { if (verbose) { out.println("the edge includer denied the inclusion."); } if (!optimalCandidatesFound) { possibleCandidates.add(Pair.of(src, delay)); Loading @@ -435,9 +426,7 @@ public final class GraphGenerator implements StrictComponent { int delay; if (possibleCandidates.isEmpty()) { if (verbose) { out.println("\t\t\tChosen incoming edge: " + SOURCE + "--" + 0 + "-->" + dst + ": "); } src = SOURCE; delay = 0; } else { Loading @@ -445,12 +434,10 @@ public final class GraphGenerator implements StrictComponent { src = srcAndDelay.first; delay = srcAndDelay.second; if (verbose) { if (optimalCandidatesFound) if (optimalCandidatesFound) { out.println("\t\t\tChosen incoming edge (optimal): " + src + "--" + delay + "-->" + dst + ": "); else out.println( "\t\t\tChosen incoming edge (not optimal): " + src + "--" + delay + "-->" + dst + ": "); } else { out.println("\t\t\tChosen incoming edge (not optimal): " + src + "--" + delay + "-->" + dst + ": "); } } Loading @@ -470,9 +457,7 @@ public final class GraphGenerator implements StrictComponent { if (!edgeCreator.outgoingEdgesOf(src).isEmpty() || src == SINK) continue; if (verbose) { out.println("\t\tTrying to generate an outgoing edge for node " + src); } int srcDepth = layers.getDepth(src); Loading @@ -495,9 +480,7 @@ public final class GraphGenerator implements StrictComponent { int delay = edgeCreator.computeEdgeDelay(src, dst); if (verbose) { out.print("\t\t\t" + src + "--" + delay + "-->" + dst + ": "); } if (isEdgePossible(src, dst, delay)) { if (edgeIncluder.includeEdge(new Edge<>(src, dst, delay, 0))) { Loading @@ -509,13 +492,11 @@ public final class GraphGenerator implements StrictComponent { possibleCandidates.add(Pair.of(dst, delay)); if (verbose) { out.println("optimal."); } } else { if (verbose) { out.println("the edge includer denied the inclusion."); } if (!optimalCandidatesFound) { possibleCandidates.add(Pair.of(dst, delay)); Loading @@ -528,9 +509,7 @@ public final class GraphGenerator implements StrictComponent { int delay; if (possibleCandidates.isEmpty()) { if (verbose) { out.println("\t\t\tChosen incoming edge: " + src + "--" + 0 + "-->" + SINK + ": "); } dst = SINK; delay = 0; } else { Loading @@ -538,12 +517,10 @@ public final class GraphGenerator implements StrictComponent { dst = dstAndDelay.first; delay = dstAndDelay.second; if (verbose) { if (optimalCandidatesFound) if (optimalCandidatesFound) { out.println("\t\t\tChosen outgoing edge (optimal): " + src + "--" + delay + "-->" + dst + ": "); else out.println( "\t\t\tChosen outgoing edge (not optimal): " + src + "--" + delay + "-->" + dst + ": "); } else { out.println("\t\t\tChosen outgoing edge (not optimal): " + src + "--" + delay + "-->" + dst + ": "); } } Loading Loading @@ -597,30 +574,22 @@ public final class GraphGenerator implements StrictComponent { int delay = edgeCreator.computeEdgeDelay(src, dst); if (verbose) { out.print( "\t\tChecking inclusion of edge " + ++currentEdgeCount + " of " + maxEdgeCount + ": " + src + "--" + delay + "-->" + dst + ": "); } if (!edgeIncluder.includeEdge(new Edge<>(src, dst, delay, 0))) { if (verbose) { out.println("the edge includer denied the inclusion."); } continue; } if (edgeChecker.hasEdgeBeenDeniedAlready(src, dst, delay) || !property.isEdgeValid(src, dst, delay)) { if (verbose) { out.println("the property denied the inclusion."); } continue; } edgeCreator.createEdge(src, dst, delay); if (verbose) { out.println("OK."); } int newDstTime = asapTimes.get(src) + src.getDelay() + delay; Loading Loading @@ -670,30 +639,22 @@ public final class GraphGenerator implements StrictComponent { int delay = edgeCreator.computeBackedgeDelay(src, dst); int distance = edgeCreator.computeBackedgeDistance(src, dst); if (verbose) { out.print( "\t\tChecking inclusion of backedge " + ++currentBackedgeCount + " of " + maxBackedgeCount + ": " + src + "--(" + delay + ", " + distance + ")-->" + dst + ": "); } if (!backedgeIncluder.includeEdge(new Edge<>(src, dst, delay, distance))) { if (verbose) { out.println("the backedge includer denied the inclusion."); } continue; } if (!property.isBackedgeValid(src, dst, delay, distance)) { if (verbose) { out.println("the property denied the inclusion."); } continue; } edgeCreator.createBackedge(src, dst, delay, distance); if (verbose) { out.println("OK."); } } } Loading Loading @@ -736,23 +697,17 @@ public final class GraphGenerator implements StrictComponent { private boolean isEdgePossible(ResourceNode src, ResourceNode dst, int delay) { if (!edgeCreator.isEdgeValid(src, dst)) { if (verbose) { out.println("the nodes are connected already."); } return false; } if (edgeChecker.hasEdgeBeenDeniedAlready(src, dst, delay)) { if (verbose) { out.println("the property denied the inclusion."); } return false; } if (!property.isEdgeValid(src, dst, delay)) { if (verbose) { out.println("the property denied the inclusion."); } edgeChecker.addEdgeDenial(src, dst, delay); return false; } Loading src/main/java/graphgen/generator/components/edges/computers/ValueComputer.java +2 −0 Changes for src/main/java/graphgen/generator/components/edges/computers/ValueComputer.java: 2 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -105,6 +105,8 @@ public abstract class ValueComputer implements EdgeCreationComponent, StrictComp /** * Tells the value computer which value it is actually computing. This edge value is then used used to determine (in * strict mode) whether or not a created edge is illegal. * * @param edgeValue the edge value whose computation this value computer is used for */ public final void setEdgeValue(EdgeValue edgeValue) { this.edgeValue = edgeValue; Loading src/main/java/graphgen/generator/components/layers/GeneratedLayerStructure.java +1 −1 Changes for src/main/java/graphgen/generator/components/layers/GeneratedLayerStructure.java: 1 added line, 1 removed line. Original line number Diff line number Diff line Loading @@ -57,7 +57,7 @@ public class GeneratedLayerStructure extends LayerStructure implements StrictCom } /** * Swaps the two IDs with each other (see {@link LayerStructure#swapIDs(int, int)}). * Swaps the two IDs with each other. * * @throws IllegalSwapException if an illegal swap is detected, i.e. if the IDs are connected with an edge during a * graph creation phase and if the swap would violate the layer structure implied by Loading Loading
src/main/java/graphgen/datastructures/Pair.java +9 −24 Changes for src/main/java/graphgen/datastructures/Pair.java: 9 added lines, 24 removed lines. Original line number Diff line number Diff line Loading @@ -64,32 +64,17 @@ public class Pair<T1, T2> { } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((first == null) ? 0 : first.hashCode()); result = prime * result + ((second == null) ? 0 : second.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) public boolean equals(Object o) { if (this == o) return true; if (obj == null) return false; if (!(obj instanceof Pair)) if (o == null || getClass() != o.getClass()) return false; Pair<?, ?> other = (Pair<?, ?>) obj; if (first == null) { if (other.first != null) return false; } else if (!first.equals(other.first)) return false; if (second == null) { return other.second == null; } else return second.equals(other.second); Pair<?, ?> pair = (Pair<?, ?>) o; return Objects.equals(first, pair.first) && Objects.equals(second, pair.second); } @Override public int hashCode() { return Objects.hash(first, second); } }
src/main/java/graphgen/datastructures/SeededRandom.java +11 −0 Changes for src/main/java/graphgen/datastructures/SeededRandom.java: 11 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -84,6 +84,17 @@ public class SeededRandom { return rng.nextDouble(); } /** * Returns a random long value. * * @return the random long value * @throws UnsupportedOperationException if this instance has not yet been seeded */ public long nextLong() { checkSeededStatus(); return rng.nextLong(); } /** * Returns the wrapped random instance. * Loading
src/main/java/graphgen/generator/GraphGenerator.java +40 −85 Changes for src/main/java/graphgen/generator/GraphGenerator.java: 40 added lines, 85 removed lines. Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package graphgen.generator; import graphgen.datastructures.Pair; import graphgen.datastructures.SeededRandom; import graphgen.enums.ResourceType; import graphgen.generator.components.StrictComponent; import graphgen.generator.components.edges.EdgeCreator; import graphgen.generator.components.edges.includers.EdgeIncluder; Loading @@ -36,6 +37,7 @@ import graphgen.util.GraphUtils; import graphgen.util.JavaUtils; import modsched.Edge; import java.io.OutputStream; import java.io.PrintStream; import java.util.ArrayList; import java.util.Collection; Loading Loading @@ -84,7 +86,6 @@ public final class GraphGenerator implements StrictComponent { private final SeededRandom rng; private final EdgeInclusionDuplicateChecker edgeChecker; private boolean verbose = false; private PrintStream out = System.out; /** Loading Loading @@ -165,9 +166,7 @@ public final class GraphGenerator implements StrictComponent { */ public Graph<ResourceNode> createGraph(long seed) { if (verbose) { out.println("Creating graph with seed " + seed); } // Reset and clear generation objects. layerCreator.reset(); Loading @@ -186,9 +185,7 @@ public final class GraphGenerator implements StrictComponent { GeneratedLayerStructure layers = layerCreator.createLayerStructure(); if (verbose) { out.println("\tGenerated layer structure: " + layers.toString()); } edgeCreator.addObserver(layers); edgeCreator.addObserver(property); Loading @@ -201,9 +198,17 @@ public final class GraphGenerator implements StrictComponent { Set<ResourceNode> nodes = nodeCreator.createNodes(layers); if (verbose) { out.println("\tGenerated nodes: " + nodes.toString()); out.print("\tResources in use: ["); List<Resource> resourcesUsed = new ArrayList<>(GraphUtils.getResources(nodes, ResourceType.ALL)); for (int i = 0; i < resourcesUsed.size(); i++) { if (i > 0) { out.print(", "); } Resource r = resourcesUsed.get(i); out.print(String.format("(%s, %d, %d)", r.name, r.delay, r.limit)); } out.println("]"); out.println("\tGenerated nodes: " + nodes.toString()); Map<Integer, ResourceNode> nodeTable = new HashMap<>(); nodes.forEach(n -> nodeTable.put(n.getId(), n)); Loading @@ -218,11 +223,9 @@ public final class GraphGenerator implements StrictComponent { edgeCreator ); if (verbose) { out.println("\tLayer structure post property generation: " + layers.toString()); out.println("\tGenerated edges post property generation: " + edgeCreator.edgeView()); out.println("\tGenerating incoming edges."); } nodes.add(SOURCE); nodes.add(SINK); Loading @@ -231,22 +234,16 @@ public final class GraphGenerator implements StrictComponent { generateIncomingEdges(layers, nodes, nodeTable, asapTimes); if (verbose) { out.println("\tGenerating outgoing edges."); } generateOutgoingEdges(layers, nodes, nodeTable, asapTimes); if (verbose) { out.println("\tGenerating optional edges."); } generateOptionalEdges(layers, nodes, nodeTable, asapTimes); verifyASAPTimesMap(edgeCreator.edgeView(), asapTimes); if (verbose) { out.println("\tGenerating remaining backedges."); } generateBackedges(asapTimes); Loading Loading @@ -280,11 +277,11 @@ public final class GraphGenerator implements StrictComponent { for (int i = 0; i < amount; i++) { if (!graphs.add(createGraph(seed)) && verbose) { out.println("Duplicate detected."); if (!graphs.add(createGraph(seed))) { out.println("Duplicate detected (seed: " + seed + ")."); } seed = rng.getRandom().nextLong(); seed = rng.nextLong(); } } else { Loading @@ -298,11 +295,11 @@ public final class GraphGenerator implements StrictComponent { if (!GraphUtils.isGraphIsomorphicToAny(graph, asapTimes, asapTimesMap)) graphs.add(graph); else if (verbose) { out.println("Isomorphism detected."); else { out.println("Isomorphism detected (seed: " + seed + ")."); } seed = rng.getRandom().nextLong(); seed = rng.nextLong(); } } Loading @@ -321,25 +318,26 @@ public final class GraphGenerator implements StrictComponent { } /** * Sets the generator to verbose mode, i.e. that the generation process will be written to the provided print * stream. * Toggles the generator's verbosity. If a print print stream is supplied, the generation process will be written to * it. If <i>out</i> is null, the generation process won't be documented. * <p> * Use <code>new PrintStream(new FileOutputStream(new File(filename))</code> to immediately write to a file.<br> * Use<p>{@code new PrintStream(new FileOutputStream(new File(filename))}<p>to immediately write to a file.<br> * <b>Warning</b>: The resulting file might be excessively large due to the * amount of edges possible in large graphs (O(2*V<sup>2</sup>)). * * @param out the print stream * @param out the print stream used to document the generation process or null to disable any generation output */ public void setVerbose(PrintStream out) { verbose = true; public void setOut(PrintStream out) { if (out == null) { this.out = new PrintStream(new OutputStream() { @Override public void write(int b) { // Do nothing. } }); } else { this.out = out; } /** * Sets the generator to non-verbose mode, i.e. that the generation process won't be documented. */ public void setNonVerbose() { verbose = false; } /** Loading Loading @@ -375,9 +373,7 @@ public final class GraphGenerator implements StrictComponent { if (hasMandatoryIncomingEdge) continue; if (verbose) { out.println("\t\tTrying to generate an incoming edge for node " + dst); } /* * Store source candidates with edge delays whose corresponding edges are Loading @@ -400,9 +396,7 @@ public final class GraphGenerator implements StrictComponent { int delay = edgeCreator.computeEdgeDelay(src, dst); if (verbose) { out.print("\t\t\t" + src + "--" + delay + "-->" + dst + ": "); } if (isEdgePossible(src, dst, delay)) { if (edgeIncluder.includeEdge(new Edge<>(src, dst, delay, 0))) { Loading @@ -414,14 +408,11 @@ public final class GraphGenerator implements StrictComponent { possibleCandidates.add(Pair.of(src, delay)); if (verbose) { out.println("optimal."); } } else { if (verbose) { out.println("the edge includer denied the inclusion."); } if (!optimalCandidatesFound) { possibleCandidates.add(Pair.of(src, delay)); Loading @@ -435,9 +426,7 @@ public final class GraphGenerator implements StrictComponent { int delay; if (possibleCandidates.isEmpty()) { if (verbose) { out.println("\t\t\tChosen incoming edge: " + SOURCE + "--" + 0 + "-->" + dst + ": "); } src = SOURCE; delay = 0; } else { Loading @@ -445,12 +434,10 @@ public final class GraphGenerator implements StrictComponent { src = srcAndDelay.first; delay = srcAndDelay.second; if (verbose) { if (optimalCandidatesFound) if (optimalCandidatesFound) { out.println("\t\t\tChosen incoming edge (optimal): " + src + "--" + delay + "-->" + dst + ": "); else out.println( "\t\t\tChosen incoming edge (not optimal): " + src + "--" + delay + "-->" + dst + ": "); } else { out.println("\t\t\tChosen incoming edge (not optimal): " + src + "--" + delay + "-->" + dst + ": "); } } Loading @@ -470,9 +457,7 @@ public final class GraphGenerator implements StrictComponent { if (!edgeCreator.outgoingEdgesOf(src).isEmpty() || src == SINK) continue; if (verbose) { out.println("\t\tTrying to generate an outgoing edge for node " + src); } int srcDepth = layers.getDepth(src); Loading @@ -495,9 +480,7 @@ public final class GraphGenerator implements StrictComponent { int delay = edgeCreator.computeEdgeDelay(src, dst); if (verbose) { out.print("\t\t\t" + src + "--" + delay + "-->" + dst + ": "); } if (isEdgePossible(src, dst, delay)) { if (edgeIncluder.includeEdge(new Edge<>(src, dst, delay, 0))) { Loading @@ -509,13 +492,11 @@ public final class GraphGenerator implements StrictComponent { possibleCandidates.add(Pair.of(dst, delay)); if (verbose) { out.println("optimal."); } } else { if (verbose) { out.println("the edge includer denied the inclusion."); } if (!optimalCandidatesFound) { possibleCandidates.add(Pair.of(dst, delay)); Loading @@ -528,9 +509,7 @@ public final class GraphGenerator implements StrictComponent { int delay; if (possibleCandidates.isEmpty()) { if (verbose) { out.println("\t\t\tChosen incoming edge: " + src + "--" + 0 + "-->" + SINK + ": "); } dst = SINK; delay = 0; } else { Loading @@ -538,12 +517,10 @@ public final class GraphGenerator implements StrictComponent { dst = dstAndDelay.first; delay = dstAndDelay.second; if (verbose) { if (optimalCandidatesFound) if (optimalCandidatesFound) { out.println("\t\t\tChosen outgoing edge (optimal): " + src + "--" + delay + "-->" + dst + ": "); else out.println( "\t\t\tChosen outgoing edge (not optimal): " + src + "--" + delay + "-->" + dst + ": "); } else { out.println("\t\t\tChosen outgoing edge (not optimal): " + src + "--" + delay + "-->" + dst + ": "); } } Loading Loading @@ -597,30 +574,22 @@ public final class GraphGenerator implements StrictComponent { int delay = edgeCreator.computeEdgeDelay(src, dst); if (verbose) { out.print( "\t\tChecking inclusion of edge " + ++currentEdgeCount + " of " + maxEdgeCount + ": " + src + "--" + delay + "-->" + dst + ": "); } if (!edgeIncluder.includeEdge(new Edge<>(src, dst, delay, 0))) { if (verbose) { out.println("the edge includer denied the inclusion."); } continue; } if (edgeChecker.hasEdgeBeenDeniedAlready(src, dst, delay) || !property.isEdgeValid(src, dst, delay)) { if (verbose) { out.println("the property denied the inclusion."); } continue; } edgeCreator.createEdge(src, dst, delay); if (verbose) { out.println("OK."); } int newDstTime = asapTimes.get(src) + src.getDelay() + delay; Loading Loading @@ -670,30 +639,22 @@ public final class GraphGenerator implements StrictComponent { int delay = edgeCreator.computeBackedgeDelay(src, dst); int distance = edgeCreator.computeBackedgeDistance(src, dst); if (verbose) { out.print( "\t\tChecking inclusion of backedge " + ++currentBackedgeCount + " of " + maxBackedgeCount + ": " + src + "--(" + delay + ", " + distance + ")-->" + dst + ": "); } if (!backedgeIncluder.includeEdge(new Edge<>(src, dst, delay, distance))) { if (verbose) { out.println("the backedge includer denied the inclusion."); } continue; } if (!property.isBackedgeValid(src, dst, delay, distance)) { if (verbose) { out.println("the property denied the inclusion."); } continue; } edgeCreator.createBackedge(src, dst, delay, distance); if (verbose) { out.println("OK."); } } } Loading Loading @@ -736,23 +697,17 @@ public final class GraphGenerator implements StrictComponent { private boolean isEdgePossible(ResourceNode src, ResourceNode dst, int delay) { if (!edgeCreator.isEdgeValid(src, dst)) { if (verbose) { out.println("the nodes are connected already."); } return false; } if (edgeChecker.hasEdgeBeenDeniedAlready(src, dst, delay)) { if (verbose) { out.println("the property denied the inclusion."); } return false; } if (!property.isEdgeValid(src, dst, delay)) { if (verbose) { out.println("the property denied the inclusion."); } edgeChecker.addEdgeDenial(src, dst, delay); return false; } Loading
src/main/java/graphgen/generator/components/edges/computers/ValueComputer.java +2 −0 Changes for src/main/java/graphgen/generator/components/edges/computers/ValueComputer.java: 2 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -105,6 +105,8 @@ public abstract class ValueComputer implements EdgeCreationComponent, StrictComp /** * Tells the value computer which value it is actually computing. This edge value is then used used to determine (in * strict mode) whether or not a created edge is illegal. * * @param edgeValue the edge value whose computation this value computer is used for */ public final void setEdgeValue(EdgeValue edgeValue) { this.edgeValue = edgeValue; Loading
src/main/java/graphgen/generator/components/layers/GeneratedLayerStructure.java +1 −1 Changes for src/main/java/graphgen/generator/components/layers/GeneratedLayerStructure.java: 1 added line, 1 removed line. Original line number Diff line number Diff line Loading @@ -57,7 +57,7 @@ public class GeneratedLayerStructure extends LayerStructure implements StrictCom } /** * Swaps the two IDs with each other (see {@link LayerStructure#swapIDs(int, int)}). * Swaps the two IDs with each other. * * @throws IllegalSwapException if an illegal swap is detected, i.e. if the IDs are connected with an edge during a * graph creation phase and if the swap would violate the layer structure implied by Loading