Commit fc62c362 authored by Sebastian Vollbrecht's avatar Sebastian Vollbrecht

Cleaned up code.

This includes:
- removal of optionals as fields
- removal of unnecessary 'public abstract' modifiers in interfaces
- more lambdas and method reference usage
- simplified dataflow
- removal of faulty integer divisions
- renaming of expected exceptions in JUnit tests
- typo fixes
parent e876a5c2
......@@ -17,7 +17,6 @@
package graphgen.datastructures;
import java.util.Optional;
import java.util.Random;
/**
......@@ -28,7 +27,7 @@ import java.util.Random;
*/
public class SeededRandom {
private Optional<Long> seed;
private Long seed;
private final Random rng;
......@@ -38,7 +37,7 @@ public class SeededRandom {
*/
public SeededRandom() {
this.rng = new Random();
this.seed = Optional.empty();
this.seed = null;
}
/**
......@@ -58,7 +57,7 @@ public class SeededRandom {
* @param seed the seed to pass to the wrapped random instance
*/
public void setSeed(long seed) {
this.seed = Optional.of(seed);
this.seed = seed;
rng.setSeed(seed);
}
......@@ -97,7 +96,7 @@ public class SeededRandom {
}
private void checkSeededStatus() {
if (!seed.isPresent()) {
if (seed == null) {
throw new UnsupportedOperationException("Must set the seed first.");
}
}
......
......@@ -34,11 +34,11 @@ public interface Initializable {
*
* @param rng the graph generator's random number generator
*/
public abstract void init(SeededRandom rng);
void init(SeededRandom rng);
/**
* Resets the implementing class, preparing it for the generation of a new graph. This method is called every time
* before the generator begins generating a new graph.
*/
public abstract void reset();
void reset();
}
......@@ -37,7 +37,7 @@ public interface EdgeCreationComponent extends Initializable {
*
* @param layers the layer structure to use
*/
public abstract void setLayerStructure(LayerStructure layers);
void setLayerStructure(LayerStructure layers);
/**
* Sets the ASAP times map of the implementing class, which can be used optionally for different purposes, such as
......@@ -45,6 +45,6 @@ public interface EdgeCreationComponent extends Initializable {
*
* @param asapTimes the ASAP times map to use
*/
public abstract void setASAPTimesMap(Map<ResourceNode, Integer> asapTimes);
void setASAPTimesMap(Map<ResourceNode, Integer> asapTimes);
}
......@@ -27,7 +27,6 @@ import modsched.Edge;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
/**
......@@ -38,7 +37,7 @@ import java.util.Set;
public class IdenticalValueComputer extends ValueComputer {
private final Map<ResourceNode, Map<ResourceNode, Integer>> edgeValues;
private final Optional<Distribution<Integer>> defaultDistribution;
private final Distribution<Integer> defaultDistribution;
/**
* Constructs a new identical value computer for the specified {@link EdgeValue}, using the provided set of edges.
......@@ -81,7 +80,7 @@ public class IdenticalValueComputer extends ValueComputer {
}
this.defaultDistribution = Optional.ofNullable(defaultDistribution);
this.defaultDistribution = defaultDistribution;
}
......@@ -92,8 +91,8 @@ public class IdenticalValueComputer extends ValueComputer {
return edgeValues.get(src).get(dst);
}
if (defaultDistribution.isPresent()) {
return defaultDistribution.get().pick();
if (defaultDistribution != null) {
return defaultDistribution.pick();
} else {
throw new IllegalArgumentException("No edge value for nodes " + src + " and " + dst + " was given.");
}
......@@ -111,12 +110,16 @@ public class IdenticalValueComputer extends ValueComputer {
@Override
public void init(SeededRandom rng) {
defaultDistribution.ifPresent(dist -> dist.init(rng));
if (defaultDistribution != null) {
defaultDistribution.init(rng);
}
}
@Override
protected void implementedReset() {
defaultDistribution.ifPresent(Distribution::reset);
if (defaultDistribution != null) {
defaultDistribution.reset();
}
}
}
......@@ -34,6 +34,6 @@ public interface FoldingStrategy<T> extends Initializable {
* @param values the list of values
* @return the folded value
*/
public abstract T fold(List<T> values);
T fold(List<T> values);
}
......@@ -22,6 +22,7 @@ import graphgen.datastructures.SeededRandom;
import graphgen.graph.Resource;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.Objects;
......@@ -66,7 +67,7 @@ public class DepthNodeCreator extends NodeCreator {
this.depthsAndNodeCreators = new ArrayList<>();
nodeCreatorsByDepth.forEach((d, c) -> depthsAndNodeCreators.add(Pair.makePair(d, c)));
depthsAndNodeCreators.sort((p1, p2) -> p1.first.compareTo(p2.first));
depthsAndNodeCreators.sort(Comparator.comparing(p -> p.first));
}
......
......@@ -39,7 +39,6 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Optional;
import java.util.Set;
/**
......@@ -71,7 +70,7 @@ public class FeasibleMinIIProperty extends Property {
private final Set<ResourceNode> enclosedNodes;
private final ModuloSchedulingFormulation formulation;
private Optional<SCC> recMinIISCC;
private SCC recMinIISCC;
/**
* Creates a new feasible MinII property which ensures the specified MinII during graph creation. The modulo
......@@ -106,11 +105,13 @@ public class FeasibleMinIIProperty extends Property {
this.minII = minII;
this.backedgeDelay = backedgeDelay;
this.backedgeDistance = backedgeDistance;
// TODO: allow inner delays >= minInnerDelay and <= maxInnerDelay
this.maxInnerDelay = SchedulingUtils.getMaxInnerDelay(minII, backedgeDelay, backedgeDistance);
this.enclosedNodes = new HashSet<>();
this.formulation = formulation;
this.recMinIISCC = Optional.empty();
this.recMinIISCC = null;
}
......@@ -123,7 +124,7 @@ public class FeasibleMinIIProperty extends Property {
* 1) There is no RecMinII-ensuring SCC, i.e. the MinII is ensured through means
* of the nodes' ResMinII.
*/
if (!recMinIISCC.isPresent())
if (recMinIISCC == null)
return true;
/*
......@@ -132,7 +133,7 @@ public class FeasibleMinIIProperty extends Property {
* SCC can thus simply be 'pushed away' (ASAP-wise) from the edge-to-be's source
* node during scheduling, without affecting its RecMinII.
*/
if (!recMinIISCC.get().getDelaysFromPreviousDstNode().containsKey(src)) {
if (!recMinIISCC.getDelaysFromPreviousDstNode().containsKey(src)) {
return true;
}
......@@ -142,7 +143,7 @@ public class FeasibleMinIIProperty extends Property {
* increased with the new edge in any way. The edge-to-be's destination node can
* thus be freely scheduled.
*/
if (!recMinIISCC.get().getDelaysToNextSrcNode().containsKey(dst)) {
if (!recMinIISCC.getDelaysToNextSrcNode().containsKey(dst)) {
return true;
}
......@@ -161,10 +162,10 @@ public class FeasibleMinIIProperty extends Property {
* 3) The delay from the edge-to-be's destination node to the backedge's source
* node.
*/
Edge<ResourceNode> recMinIIBackedge = recMinIISCC.get().getBackedges().get(0);
int delayFromBackedgeDst = recMinIISCC.get().getDelaysFromPreviousDstNode().get(src);
Edge<ResourceNode> recMinIIBackedge = recMinIISCC.getBackedges().get(0);
int delayFromBackedgeDst = recMinIISCC.getDelaysFromPreviousDstNode().get(src);
int delayInBetween = src.getDelay() + delay;
int delayToBackedgeSrc = recMinIISCC.get().getDelaysToNextSrcNode().get(dst);
int delayToBackedgeSrc = recMinIISCC.getDelaysToNextSrcNode().get(dst);
int resultingPathDelay = delayFromBackedgeDst + delayInBetween + delayToBackedgeSrc;
......@@ -284,22 +285,22 @@ public class FeasibleMinIIProperty extends Property {
Edge<ResourceNode> theBackedge = createMaxInnerDelayPath(initialPairs, nodesByDelay);
recMinIISCC = Optional.of(new SCC(Arrays.asList(theBackedge), layers, edgeCreator));
enclosedNodes.addAll(recMinIISCC.get().update(minII));
recMinIISCC = new SCC(Arrays.asList(theBackedge), layers, edgeCreator);
enclosedNodes.addAll(recMinIISCC.update(minII));
}
@Override
public void reset() {
recMinIISCC = Optional.empty();
recMinIISCC = null;
enclosedNodes.clear();
}
@Override
public void notify(Edge<ResourceNode> edge) {
if (!edge.isBackedge() && recMinIISCC.isPresent()) {
enclosedNodes.addAll(recMinIISCC.get().update(minII));
if (!edge.isBackedge() && recMinIISCC != null) {
enclosedNodes.addAll(recMinIISCC.update(minII));
} else if (edge.isBackedge()) {
enclosedNodes.addAll(findAllEnclosedNodes(edgeCreator.edgeView(), edgeCreator.incomingEdgesView()));
}
......
......@@ -26,7 +26,7 @@ import java.util.Objects;
/**
* The start configuration represents the very start of an infeasible cycle. It contains the <i>destination node</i> and
* the layer it is located in. The destination node is the single node which all backedges of the infasible cycle must
* the layer it is located in. The destination node is the single node which all backedges of the infeasible cycle must
* later connect to (hence the name <i>destination</i> node).
*
* @author Sebastian Vollbrecht
......
......@@ -333,10 +333,11 @@ public final class LayerStructure implements Serializable, Iterable<Integer>, Ob
Set<Integer> preds = incomingEdges.get(secondID);
int maxPredDepth = preds.stream().mapToInt(depthsByID::get).max().getAsInt();
int maxPredDepth = preds.stream().mapToInt(depthsByID::get).max().orElse(0);
if (maxPredDepth >= firstDepth)
if (maxPredDepth >= firstDepth) {
return false;
}
}
......@@ -344,10 +345,9 @@ public final class LayerStructure implements Serializable, Iterable<Integer>, Ob
Set<Integer> succs = outgoingEdges.get(firstID);
int minSuccDepth = succs.stream().mapToInt(depthsByID::get).min().getAsInt();
int minSuccDepth = succs.stream().mapToInt(depthsByID::get).min().orElse(0);
if (minSuccDepth <= secondDepth)
return false;
return minSuccDepth > secondDepth;
}
......
......@@ -31,6 +31,6 @@ public interface Observer<T> {
*
* @param t the change of state
*/
public abstract void notify(T t);
void notify(T t);
}
......@@ -54,7 +54,7 @@ public class DistributionUtils {
* @return the probabilities
*/
public static double[] normalDistribution(double mean, double standardDeviation, int times) {
return normalDistribution(mean, standardDeviation, times, -times / 2);
return normalDistribution(mean, standardDeviation, times, -times / (double) 2);
}
/**
......
......@@ -38,56 +38,6 @@ public class MathUtils {
return c.stream().mapToInt(Integer::intValue).sum();
}
/**
* Calculates the sum of the given collection of doubles.
*
* @param c the collection to sum
* @return the sum of its elements
*/
public static double sumDouble(Collection<Double> c) {
return c.stream().mapToDouble(Double::doubleValue).sum();
}
/**
* Calculates the sum of the given collection of longs.
*
* @param c the collection to sum
* @return the sum of its elements
*/
public static double sumLong(Collection<Long> c) {
return c.stream().mapToLong(Long::longValue).sum();
}
/**
* Calculates the arithmetic mean of the given collection of integers.
*
* @param c the collection to average
* @return the arithmetic mean of its elements
*/
public static double meanInteger(Collection<Integer> c) {
return c.stream().mapToInt(Integer::intValue).average().getAsDouble();
}
/**
* Calculates the arithmetic mean of the given collection of doubles.
*
* @param c the collection to average
* @return the arithmetic mean of its elements
*/
public static double meanDouble(Collection<Double> c) {
return c.stream().mapToDouble(Double::doubleValue).average().getAsDouble();
}
/**
* Calculates the arithmetic mean of the given collection of longs.
*
* @param c the collection to average
* @return the arithmetic mean of its elements
*/
public static double meanLong(Collection<Long> c) {
return c.stream().mapToLong(Long::longValue).average().getAsDouble();
}
/**
* Randomly picks a number from the inclusive [min, max] range.
*
......
......@@ -34,7 +34,6 @@ import modsched.MoovacFormulation;
import modsched.Node;
import modsched.Schedule;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;
import java.util.ArrayList;
......@@ -158,7 +157,7 @@ public class SchedulingUtils {
System.setOut(new PrintStream(new OutputStream() {
@Override
public void write(int b) throws IOException {
public void write(int b) {
// Do nothing.
}
}));
......@@ -173,13 +172,8 @@ public class SchedulingUtils {
if (maxTotalTime == null) {
s = f.schedule(minII, maxII, r -> r.limit, Resource::isUnlimited, TIMELIMIT_CANDIDATE);
} else {
Callable<Schedule> callable = new Callable<Schedule>() {
@Override
public Schedule call() throws Exception {
return f.schedule(minII, maxII, r -> r.limit, Resource::isUnlimited, TIMELIMIT_CANDIDATE);
}
};
Callable<Schedule> callable = () -> f
.schedule(minII, maxII, r -> r.limit, Resource::isUnlimited, TIMELIMIT_CANDIDATE);
RunnableFuture<Schedule> future = new FutureTask<>(callable);
ExecutorService service = Executors.newSingleThreadExecutor();
......@@ -364,7 +358,7 @@ public class SchedulingUtils {
* bounds should be returned.
*/
int maxII = layers.getLastLayer().stream().map(graph::getNode)
.mapToInt(n -> earliestPossibleTimes.get(n) + n.getDelay()).max().getAsInt();
.mapToInt(n -> earliestPossibleTimes.get(n) + n.getDelay()).max().orElse(0);
return Math.max(maxII, getMinII(graph));
......
......@@ -103,11 +103,10 @@ public class Edge<N extends Node> implements Comparable<Edge<N>>, Serializable {
} else if (!dst.equals(other.dst))
return false;
if (src == null) {
if (other.src != null)
return false;
} else if (!src.equals(other.src))
return false;
return true;
return other.src == null;
} else {
return src.equals(other.src);
}
}
}
......@@ -92,9 +92,7 @@ public class Node implements Comparable<Node>, Serializable {
Node other = (Node) obj;
if (delay != other.delay)
return false;
if (id != other.id)
return false;
return true;
return id == other.id;
}
}
......@@ -58,7 +58,7 @@ public class DistributionNodeCreatorTest {
fail("This call should have thrown an exception!");
} catch (NullPointerException e) {
} catch (NullPointerException expected) {
}
}
......
......@@ -96,7 +96,7 @@ public class FeasibleMinIIPropertyTest {
fail("This call should have thrown an exception!");
} catch (MinIIImpossibleException e) {
} catch (MinIIImpossibleException expected) {
}
......@@ -329,7 +329,7 @@ public class FeasibleMinIIPropertyTest {
ResourceNode n_3 = new ResourceNode(id++, add);
ResourceNode n_4 = new ResourceNode(id++, add);
ResourceNode n_5 = new ResourceNode(id++, add);
ResourceNode n_6 = new ResourceNode(id++, unl);
ResourceNode n_6 = new ResourceNode(id, unl);
Set<ResourceNode> nodes = new HashSet<>();
nodes.add(n_0);
......@@ -339,8 +339,7 @@ public class FeasibleMinIIPropertyTest {
nodes.add(n_4);
nodes.add(n_5);
nodes.add(n_6);
IdenticalNodeCreator mapper = new IdenticalNodeCreator(nodes);
NodeCreator nc = mapper;
NodeCreator nc = new IdenticalNodeCreator(nodes);
LayerStructureBuilder builder = new LayerStructureBuilder(4);
......@@ -352,7 +351,7 @@ public class FeasibleMinIIPropertyTest {
builder.addNode(1, id++);
builder.addNode(2, id++);
builder.addNode(2, id++);
builder.addNode(3, id++);
builder.addNode(3, id);
LayerCreator lc = new IdenticalLayerCreator(builder.build());
Set<Edge<ResourceNode>> edges = new HashSet<>();
......@@ -408,7 +407,7 @@ public class FeasibleMinIIPropertyTest {
ResourceNode n_3 = new ResourceNode(id++, mul);
ResourceNode n_4 = new ResourceNode(id++, mul);
ResourceNode n_5 = new ResourceNode(id++, mul);
ResourceNode n_6 = new ResourceNode(id++, unl);
ResourceNode n_6 = new ResourceNode(id, unl);
Set<ResourceNode> nodes = new HashSet<>();
nodes.add(n_0);
......@@ -418,8 +417,7 @@ public class FeasibleMinIIPropertyTest {
nodes.add(n_4);
nodes.add(n_5);
nodes.add(n_6);
IdenticalNodeCreator mapper = new IdenticalNodeCreator(nodes);
NodeCreator nc = mapper;
NodeCreator nc = new IdenticalNodeCreator(nodes);
LayerStructureBuilder builder = new LayerStructureBuilder(6);
......@@ -431,7 +429,7 @@ public class FeasibleMinIIPropertyTest {
builder.addNode(3, id++);
builder.addNode(4, id++);
builder.addNode(1, id++);
builder.addNode(5, id++);
builder.addNode(5, id);
LayerCreator lc = new IdenticalLayerCreator(builder.build());
Set<Edge<ResourceNode>> edges = new HashSet<>();
......@@ -485,7 +483,7 @@ public class FeasibleMinIIPropertyTest {
ResourceNode n_3 = new ResourceNode(id++, mul);
ResourceNode n_4 = new ResourceNode(id++, mul);
ResourceNode n_5 = new ResourceNode(id++, mul);
ResourceNode n_6 = new ResourceNode(id++, unl);
ResourceNode n_6 = new ResourceNode(id, unl);
Set<ResourceNode> nodes = new HashSet<>();
nodes.add(n_0);
......@@ -495,8 +493,7 @@ public class FeasibleMinIIPropertyTest {
nodes.add(n_4);
nodes.add(n_5);
nodes.add(n_6);
IdenticalNodeCreator mapper = new IdenticalNodeCreator(nodes);
NodeCreator nc = mapper;
NodeCreator nc = new IdenticalNodeCreator(nodes);
LayerStructureBuilder builder = new LayerStructureBuilder(6);
......@@ -508,7 +505,7 @@ public class FeasibleMinIIPropertyTest {
builder.addNode(3, id++);
builder.addNode(3, id++);
builder.addNode(4, id++);
builder.addNode(5, id++);
builder.addNode(5, id);
LayerCreator lc = new IdenticalLayerCreator(builder.build());
Set<Edge<ResourceNode>> edges = new HashSet<>();
......@@ -564,7 +561,7 @@ public class FeasibleMinIIPropertyTest {
ResourceNode n_3 = new ResourceNode(id++, mul);
ResourceNode n_4 = new ResourceNode(id++, mul);
ResourceNode n_5 = new ResourceNode(id++, mul);
ResourceNode n_6 = new ResourceNode(id++, unl);
ResourceNode n_6 = new ResourceNode(id, unl);
Set<ResourceNode> nodes = new HashSet<>();
nodes.add(n_0);
......@@ -574,8 +571,7 @@ public class FeasibleMinIIPropertyTest {
nodes.add(n_4);
nodes.add(n_5);
nodes.add(n_6);
IdenticalNodeCreator mapper = new IdenticalNodeCreator(nodes);
NodeCreator nc = mapper;
NodeCreator nc = new IdenticalNodeCreator(nodes);
LayerStructureBuilder builder = new LayerStructureBuilder(6);
......@@ -587,7 +583,7 @@ public class FeasibleMinIIPropertyTest {
builder.addNode(3, id++);
builder.addNode(3, id++);
builder.addNode(4, id++);
builder.addNode(5, id++);
builder.addNode(5, id);
LayerCreator lc = new IdenticalLayerCreator(builder.build());
Set<Edge<ResourceNode>> edges = new HashSet<>();
......@@ -643,7 +639,7 @@ public class FeasibleMinIIPropertyTest {
ResourceNode n_3 = new ResourceNode(id++, mul);
ResourceNode n_4 = new ResourceNode(id++, mul);
ResourceNode n_5 = new ResourceNode(id++, mul);
ResourceNode n_6 = new ResourceNode(id++, unl);
ResourceNode n_6 = new ResourceNode(id, unl);
Set<ResourceNode> nodes = new HashSet<>();
nodes.add(n_0);
......@@ -653,8 +649,7 @@ public class FeasibleMinIIPropertyTest {
nodes.add(n_4);
nodes.add(n_5);
nodes.add(n_6);
IdenticalNodeCreator mapper = new IdenticalNodeCreator(nodes);
NodeCreator nc = mapper;
NodeCreator nc = new IdenticalNodeCreator(nodes);
LayerStructureBuilder builder = new LayerStructureBuilder(6);
......@@ -666,7 +661,7 @@ public class FeasibleMinIIPropertyTest {
builder.addNode(3, id++);
builder.addNode(3, id++);
builder.addNode(4, id++);
builder.addNode(5, id++);
builder.addNode(5, id);
LayerCreator lc = new IdenticalLayerCreator(builder.build());
Set<Edge<ResourceNode>> edges = new HashSet<>();
......@@ -723,7 +718,7 @@ public class FeasibleMinIIPropertyTest {
ResourceNode n_4 = new ResourceNode(id++, mul);
ResourceNode n_5 = new ResourceNode(id++, mul);
ResourceNode n_6 = new ResourceNode(id++, unl);
ResourceNode n_7 = new ResourceNode(id++, mul);
ResourceNode n_7 = new ResourceNode(id, mul);
Set<ResourceNode> nodes = new HashSet<>();
nodes.add(n_0);
......@@ -734,8 +729,7 @@ public class FeasibleMinIIPropertyTest {
nodes.add(n_5);
nodes.add(n_6);
nodes.add(n_7);
IdenticalNodeCreator mapper = new IdenticalNodeCreator(nodes);
NodeCreator nc = mapper;
NodeCreator nc = new IdenticalNodeCreator(nodes);
LayerStructureBuilder builder = new LayerStructureBuilder(6);
......@@ -748,7 +742,7 @@ public class FeasibleMinIIPropertyTest {
builder.addNode(3, id++);
builder.addNode(3, id++);
builder.addNode(4, id++);
builder.addNode(5, id++);
builder.addNode(5, id);
LayerCreator lc = new IdenticalLayerCreator(builder.build());
Set<Edge<ResourceNode>> edges = new HashSet<>();
......@@ -835,7 +829,7 @@ public class FeasibleMinIIPropertyTest {
fail("This call should have thrown an exception!");
} catch (MinIIImpossibleException e) {
} catch (MinIIImpossibleException expected) {
}
......@@ -848,11 +842,11 @@ public class FeasibleMinIIPropertyTest {
public void pass_Problematic_Graphs() {
pass_fixed(15, 10, -581710397572693554L, 75, ModuloSchedulingFormulation.MOOVAC);
pass_fixed(15, 10, -3851022399824989015l, 75, ModuloSchedulingFormulation.MOOVAC);
pass_fixed(15, 10, -7862773110526989099l, 75, ModuloSchedulingFormulation.MOOVAC);
pass_fixed(15, 10, 9019645924926150149l, 75, ModuloSchedulingFormulation.MOOVAC);
pass_fixed(15, 10, 1993426915531204788l, 75, ModuloSchedulingFormulation.MOOVAC);
pass_fixed(150, 20, 346496231322324059l, 75, ModuloSchedulingFormulation.MOOVAC);
pass_fixed(15, 10, -3851022399824989015L, 75, ModuloSchedulingFormulation.MOOVAC);
pass_fixed(15, 10, -7862773110526989099L, 75, ModuloSchedulingFormulation.MOOVAC);
pass_fixed(15, 10, 9019645924926150149L, 75, ModuloSchedulingFormulation.MOOVAC);
pass_fixed(15, 10, 1993426915531204788L, 75, ModuloSchedulingFormulation.MOOVAC);
pass_fixed(150, 20, 346496231322324059L, 75, ModuloSchedulingFormulation.MOOVAC);
pass_fixed(15, 8, 7843376953379364940L, 25, ModuloSchedulingFormulation.MOOVAC);
pass_fixed(21, 16, -7273887666308285771L, 25, ModuloSchedulingFormulation.MOOVAC);
pass_fixed(20, 16, 4261077924447358888L, 25, ModuloSchedulingFormulation.MOOVAC);
......
......@@ -97,7 +97,7 @@ public class InfeasibleMinIIPropertyTest {
fail("This call should have thrown an exception!");
} catch (MinIIImpossibleException e) {
} catch (MinIIImpossibleException expected) {
}
......@@ -182,7 +182,7 @@ public class InfeasibleMinIIPropertyTest {
LayerCreator lc = new FixedShapeLayerCreator(nodesPerLayer);
GraphGenerator gg = new GraphGenerator(lc, nc, ec, edgeIncluder, backedgeIncluder, property);
Long seed = 42L;
long seed = 42L;
try {
gg.createGraph(seed);
......@@ -190,7 +190,7 @@ public class InfeasibleMinIIPropertyTest {
fail("This call should have failed. Seed: " + seed);
} catch (InfeasibilityImpossibleException e) {
assertEquals(seed.toString(), InfeasibilityImpossibleCause.NO_PROBLEMATIC_RESOURCE, e.cause);
assertEquals(Long.toString(seed), InfeasibilityImpossibleCause.NO_PROBLEMATIC_RESOURCE, e.cause);
}
}
......@@ -333,7 +333,7 @@ public class InfeasibleMinIIPropertyTest {
nodes.add(new ResourceNode(id++, add));
nodes.add(new ResourceNode(id++, add));
nodes.add(new ResourceNode(id++, add));
nodes.add(new ResourceNode(id++, add));
nodes.add(new ResourceNode(id, add));
NodeCreator nc = new IdenticalNodeCreator(nodes);
......@@ -373,7 +373,7 @@ public class InfeasibleMinIIPropertyTest {
nodes.add(new ResourceNode(id++, add));
nodes.add(new ResourceNode(id++, add));
nodes.add(new ResourceNode(id++, add));
nodes.add(new ResourceNode(id++, add));
nodes.add(new ResourceNode(id, add));
NodeCreator nc = new IdenticalNodeCreator(nodes);
......@@ -426,7 +426,7 @@ public class InfeasibleMinIIPropertyTest {
int id = GraphGenerator.SINK.getId() + 1;
Set<ResourceNode> nodes = new HashSet<>();