Commit 26f9eb00 authored by Sebastian Vollbrecht's avatar Sebastian Vollbrecht

Merge branch 'master' into 3-refactor-feasibleminiiproperty

parents 41146d31 e89fbf89
...@@ -21,7 +21,7 @@ import java.util.Objects; ...@@ -21,7 +21,7 @@ import java.util.Objects;
/** /**
* A basic class for arranging objects in pairs. Every pairing is immutable once created. To create a pair, use the * A basic class for arranging objects in pairs. Every pairing is immutable once created. To create a pair, use the
* static {@link Pair#makePair(Object, Object)} constructor. * static {@link Pair#of(Object, Object)} constructor.
* *
* @param <T1> the type of the first element * @param <T1> the type of the first element
* @param <T2> the type of the second element * @param <T2> the type of the second element
...@@ -54,7 +54,7 @@ public class Pair<T1, T2> { ...@@ -54,7 +54,7 @@ public class Pair<T1, T2> {
* @return a (first, second) pair * @return a (first, second) pair
* @throws NullPointerException if an element is null * @throws NullPointerException if an element is null
*/ */
public static <X, Y> Pair<X, Y> makePair(X first, Y second) { public static <X, Y> Pair<X, Y> of(X first, Y second) {
return new Pair<>(first, second); return new Pair<>(first, second);
} }
......
...@@ -419,7 +419,7 @@ public final class GraphGenerator { ...@@ -419,7 +419,7 @@ public final class GraphGenerator {
optimalCandidatesFound = true; optimalCandidatesFound = true;
} }
possibleCandidates.add(Pair.makePair(src, delay)); possibleCandidates.add(Pair.of(src, delay));
if (verbose) { if (verbose) {
out.println("optimal."); out.println("optimal.");
...@@ -431,7 +431,7 @@ public final class GraphGenerator { ...@@ -431,7 +431,7 @@ public final class GraphGenerator {
} }
if (!optimalCandidatesFound) { if (!optimalCandidatesFound) {
possibleCandidates.add(Pair.makePair(src, delay)); possibleCandidates.add(Pair.of(src, delay));
} }
} }
} }
...@@ -514,7 +514,7 @@ public final class GraphGenerator { ...@@ -514,7 +514,7 @@ public final class GraphGenerator {
optimalCandidatesFound = true; optimalCandidatesFound = true;
} }
possibleCandidates.add(Pair.makePair(dst, delay)); possibleCandidates.add(Pair.of(dst, delay));
if (verbose) { if (verbose) {
out.println("optimal."); out.println("optimal.");
...@@ -525,7 +525,7 @@ public final class GraphGenerator { ...@@ -525,7 +525,7 @@ public final class GraphGenerator {
} }
if (!optimalCandidatesFound) { if (!optimalCandidatesFound) {
possibleCandidates.add(Pair.makePair(dst, delay)); possibleCandidates.add(Pair.of(dst, delay));
} }
} }
} }
......
...@@ -70,7 +70,7 @@ public class DepthValueComputer extends ValueComputer { ...@@ -70,7 +70,7 @@ public class DepthValueComputer extends ValueComputer {
this.depthsAndValueComputers = new ArrayList<>(); this.depthsAndValueComputers = new ArrayList<>();
this.useASAPDepths = useASAPDepths; this.useASAPDepths = useASAPDepths;
valueComputersByDepth.forEach((d, c) -> depthsAndValueComputers.add(Pair.makePair(d, c))); valueComputersByDepth.forEach((d, c) -> depthsAndValueComputers.add(Pair.of(d, c)));
depthsAndValueComputers.sort(Comparator.comparing(p -> p.first)); depthsAndValueComputers.sort(Comparator.comparing(p -> p.first));
} }
......
...@@ -74,7 +74,7 @@ public class DepthEdgeIncluder extends EdgeIncluder { ...@@ -74,7 +74,7 @@ public class DepthEdgeIncluder extends EdgeIncluder {
this.depthsAndEdgeIncluders = new ArrayList<>(); this.depthsAndEdgeIncluders = new ArrayList<>();
this.useASAPDepths = useASAPDepths; this.useASAPDepths = useASAPDepths;
edgeIncludersByDepth.forEach((d, c) -> depthsAndEdgeIncluders.add(Pair.makePair(d, c))); edgeIncludersByDepth.forEach((d, c) -> depthsAndEdgeIncluders.add(Pair.of(d, c)));
depthsAndEdgeIncluders.sort(Comparator.comparing(p -> p.first)); depthsAndEdgeIncluders.sort(Comparator.comparing(p -> p.first));
} }
......
...@@ -66,7 +66,7 @@ public class DepthNodeCreator extends NodeCreator { ...@@ -66,7 +66,7 @@ public class DepthNodeCreator extends NodeCreator {
this.depthsAndNodeCreators = new ArrayList<>(); this.depthsAndNodeCreators = new ArrayList<>();
nodeCreatorsByDepth.forEach((d, c) -> depthsAndNodeCreators.add(Pair.makePair(d, c))); nodeCreatorsByDepth.forEach((d, c) -> depthsAndNodeCreators.add(Pair.of(d, c)));
depthsAndNodeCreators.sort(Comparator.comparing(p -> p.first)); depthsAndNodeCreators.sort(Comparator.comparing(p -> p.first));
} }
......
...@@ -415,7 +415,7 @@ public class FeasibleMinIIProperty extends Property { ...@@ -415,7 +415,7 @@ public class FeasibleMinIIProperty extends Property {
} }
} }
possiblePairs.add(Pair.makePair(firstNode, secondNode)); possiblePairs.add(Pair.of(firstNode, secondNode));
} }
} }
......
...@@ -124,7 +124,7 @@ public class InfeasibleEdgePlanner { ...@@ -124,7 +124,7 @@ public class InfeasibleEdgePlanner {
Set<ResourceNode> predecessors = getPossiblePredecessors(fixedNode, startCfg, infeasibleCfg); Set<ResourceNode> predecessors = getPossiblePredecessors(fixedNode, startCfg, infeasibleCfg);
ResourceNode predecessor = JavaUtils.pickRandomElement(predecessors, rng); ResourceNode predecessor = JavaUtils.pickRandomElement(predecessors, rng);
Pair<ResourceNode, ResourceNode> pair = Pair.makePair(predecessor, fixedNode); Pair<ResourceNode, ResourceNode> pair = Pair.of(predecessor, fixedNode);
predecessorsByNode.put(fixedNode, predecessor); predecessorsByNode.put(fixedNode, predecessor);
...@@ -143,7 +143,7 @@ public class InfeasibleEdgePlanner { ...@@ -143,7 +143,7 @@ public class InfeasibleEdgePlanner {
if (i == 0) { if (i == 0) {
for (ResourceNode src : infeasibleCfg.getLowestProblematicNodes()) { for (ResourceNode src : infeasibleCfg.getLowestProblematicNodes()) {
Pair<ResourceNode, ResourceNode> pair = Pair.makePair(src, suffixNode); Pair<ResourceNode, ResourceNode> pair = Pair.of(src, suffixNode);
predecessorsByNode.put(suffixNode, src); predecessorsByNode.put(suffixNode, src);
...@@ -156,7 +156,7 @@ public class InfeasibleEdgePlanner { ...@@ -156,7 +156,7 @@ public class InfeasibleEdgePlanner {
} else { } else {
ResourceNode src = suffixCfg.getSuffixNodes().get(i - 1); ResourceNode src = suffixCfg.getSuffixNodes().get(i - 1);
Pair<ResourceNode, ResourceNode> pair = Pair.makePair(src, suffixNode); Pair<ResourceNode, ResourceNode> pair = Pair.of(src, suffixNode);
predecessorsByNode.put(suffixNode, src); predecessorsByNode.put(suffixNode, src);
......
...@@ -149,7 +149,7 @@ public class DepthIterator<N extends Node> implements Iterator<Pair<Double, Set< ...@@ -149,7 +149,7 @@ public class DepthIterator<N extends Node> implements Iterator<Pair<Double, Set<
@Override @Override
public Pair<Double, Set<N>> next() { public Pair<Double, Set<N>> next() {
Pair<Double, Set<N>> currentPair = Pair.makePair(currentDepth, nodeDepths.get(currentDepth)); Pair<Double, Set<N>> currentPair = Pair.of(currentDepth, nodeDepths.get(currentDepth));
currentDepth = getNextDepth(); currentDepth = getNextDepth();
return currentPair; return currentPair;
......
...@@ -1221,7 +1221,7 @@ public class GraphUtils { ...@@ -1221,7 +1221,7 @@ public class GraphUtils {
Resource r = entry.getKey(); Resource r = entry.getKey();
Pair<Integer, Integer> delLimPair = Pair.makePair(r.delay, r.limit); Pair<Integer, Integer> delLimPair = Pair.of(r.delay, r.limit);
g1DelLimPairsToResources.putIfAbsent(delLimPair, new HashSet<>()); g1DelLimPairsToResources.putIfAbsent(delLimPair, new HashSet<>());
g1DelLimPairsToResources.get(delLimPair).add(r); g1DelLimPairsToResources.get(delLimPair).add(r);
...@@ -1241,7 +1241,7 @@ public class GraphUtils { ...@@ -1241,7 +1241,7 @@ public class GraphUtils {
Resource r = entry.getKey(); Resource r = entry.getKey();
Pair<Integer, Integer> delLimPair = Pair.makePair(r.delay, r.limit); Pair<Integer, Integer> delLimPair = Pair.of(r.delay, r.limit);
g2DelLimPairsToResources.putIfAbsent(delLimPair, new HashSet<>()); g2DelLimPairsToResources.putIfAbsent(delLimPair, new HashSet<>());
g2DelLimPairsToResources.get(delLimPair).add(r); g2DelLimPairsToResources.get(delLimPair).add(r);
......
...@@ -424,11 +424,11 @@ public class InfeasibleEdgePlannerTest { ...@@ -424,11 +424,11 @@ public class InfeasibleEdgePlannerTest {
InfeasibleEdgePlanner planner = new InfeasibleEdgePlanner(startCfg, infeasibleCfg, suffixCfg, rng); InfeasibleEdgePlanner planner = new InfeasibleEdgePlanner(startCfg, infeasibleCfg, suffixCfg, rng);
Pair<ResourceNode, ResourceNode> pair3_4 = Pair.makePair(node3, node4); Pair<ResourceNode, ResourceNode> pair3_4 = Pair.of(node3, node4);
Pair<ResourceNode, ResourceNode> pair3_5 = Pair.makePair(node3, node5); Pair<ResourceNode, ResourceNode> pair3_5 = Pair.of(node3, node5);
Pair<ResourceNode, ResourceNode> pair5_6 = Pair.makePair(node5, node6); Pair<ResourceNode, ResourceNode> pair5_6 = Pair.of(node5, node6);
Pair<ResourceNode, ResourceNode> pair5_7 = Pair.makePair(node5, node7); Pair<ResourceNode, ResourceNode> pair5_7 = Pair.of(node5, node7);
Pair<ResourceNode, ResourceNode> pair7_8 = Pair.makePair(node7, node8); Pair<ResourceNode, ResourceNode> pair7_8 = Pair.of(node7, node8);
Set<Pair<ResourceNode, ResourceNode>> pairs = JavaUtils.asSet(pair3_4, pair3_5, pair5_6, pair5_7, pair7_8); Set<Pair<ResourceNode, ResourceNode>> pairs = JavaUtils.asSet(pair3_4, pair3_5, pair5_6, pair5_7, pair7_8);
...@@ -493,13 +493,13 @@ public class InfeasibleEdgePlannerTest { ...@@ -493,13 +493,13 @@ public class InfeasibleEdgePlannerTest {
InfeasibleEdgePlanner planner = new InfeasibleEdgePlanner(startCfg, infeasibleCfg, suffixCfg, rng); InfeasibleEdgePlanner planner = new InfeasibleEdgePlanner(startCfg, infeasibleCfg, suffixCfg, rng);
Pair<ResourceNode, ResourceNode> pair3_4 = Pair.makePair(node3, node4); Pair<ResourceNode, ResourceNode> pair3_4 = Pair.of(node3, node4);
Pair<ResourceNode, ResourceNode> pair3_5 = Pair.makePair(node3, node5); Pair<ResourceNode, ResourceNode> pair3_5 = Pair.of(node3, node5);
Pair<ResourceNode, ResourceNode> pair5_6 = Pair.makePair(node5, node6); Pair<ResourceNode, ResourceNode> pair5_6 = Pair.of(node5, node6);
Pair<ResourceNode, ResourceNode> pair5_7 = Pair.makePair(node5, node7); Pair<ResourceNode, ResourceNode> pair5_7 = Pair.of(node5, node7);
Pair<ResourceNode, ResourceNode> pair7_8 = Pair.makePair(node7, node8); Pair<ResourceNode, ResourceNode> pair7_8 = Pair.of(node7, node8);
Pair<ResourceNode, ResourceNode> pair8_9 = Pair.makePair(node8, node9); Pair<ResourceNode, ResourceNode> pair8_9 = Pair.of(node8, node9);
Pair<ResourceNode, ResourceNode> pair9_10 = Pair.makePair(node9, node10); Pair<ResourceNode, ResourceNode> pair9_10 = Pair.of(node9, node10);
Set<Pair<ResourceNode, ResourceNode>> pairs = JavaUtils Set<Pair<ResourceNode, ResourceNode>> pairs = JavaUtils
.asSet(pair3_4, pair3_5, pair5_6, pair5_7, pair7_8, pair8_9, pair9_10); .asSet(pair3_4, pair3_5, pair5_6, pair5_7, pair7_8, pair8_9, pair9_10);
...@@ -562,9 +562,9 @@ public class InfeasibleEdgePlannerTest { ...@@ -562,9 +562,9 @@ public class InfeasibleEdgePlannerTest {
InfeasibleEdgePlanner planner = new InfeasibleEdgePlanner(startCfg, infeasibleCfg, suffixCfg, rng); InfeasibleEdgePlanner planner = new InfeasibleEdgePlanner(startCfg, infeasibleCfg, suffixCfg, rng);
Pair<ResourceNode, ResourceNode> pair3_4 = Pair.makePair(node3, node4); Pair<ResourceNode, ResourceNode> pair3_4 = Pair.of(node3, node4);
Pair<ResourceNode, ResourceNode> pair4_6 = Pair.makePair(node4, node6); Pair<ResourceNode, ResourceNode> pair4_6 = Pair.of(node4, node6);
Pair<ResourceNode, ResourceNode> pair6_8 = Pair.makePair(node6, node8); Pair<ResourceNode, ResourceNode> pair6_8 = Pair.of(node6, node8);
Set<Pair<ResourceNode, ResourceNode>> pairs = JavaUtils.asSet(pair3_4, pair4_6, pair6_8); Set<Pair<ResourceNode, ResourceNode>> pairs = JavaUtils.asSet(pair3_4, pair4_6, pair6_8);
...@@ -626,10 +626,10 @@ public class InfeasibleEdgePlannerTest { ...@@ -626,10 +626,10 @@ public class InfeasibleEdgePlannerTest {
InfeasibleEdgePlanner planner = new InfeasibleEdgePlanner(startCfg, infeasibleCfg, suffixCfg, rng); InfeasibleEdgePlanner planner = new InfeasibleEdgePlanner(startCfg, infeasibleCfg, suffixCfg, rng);
Pair<ResourceNode, ResourceNode> pair3_4 = Pair.makePair(node3, node4); Pair<ResourceNode, ResourceNode> pair3_4 = Pair.of(node3, node4);
Pair<ResourceNode, ResourceNode> pair4_6 = Pair.makePair(node4, node6); Pair<ResourceNode, ResourceNode> pair4_6 = Pair.of(node4, node6);
Pair<ResourceNode, ResourceNode> pair6_8 = Pair.makePair(node6, node8); Pair<ResourceNode, ResourceNode> pair6_8 = Pair.of(node6, node8);
Pair<ResourceNode, ResourceNode> pair8_9 = Pair.makePair(node8, node9); Pair<ResourceNode, ResourceNode> pair8_9 = Pair.of(node8, node9);
Set<Pair<ResourceNode, ResourceNode>> pairs = JavaUtils.asSet(pair3_4, pair4_6, pair6_8, pair8_9); Set<Pair<ResourceNode, ResourceNode>> pairs = JavaUtils.asSet(pair3_4, pair4_6, pair6_8, pair8_9);
...@@ -704,13 +704,13 @@ public class InfeasibleEdgePlannerTest { ...@@ -704,13 +704,13 @@ public class InfeasibleEdgePlannerTest {
Set<PlannedEdge> edges = JavaUtils.asSet(edge3_4, edge3_5, edge5_6, edge5_7, edge7_8, edge8_9, edge9_10); Set<PlannedEdge> edges = JavaUtils.asSet(edge3_4, edge3_5, edge5_6, edge5_7, edge7_8, edge8_9, edge9_10);
Pair<ResourceNode, ResourceNode> pair3_4 = Pair.makePair(node3, node4); Pair<ResourceNode, ResourceNode> pair3_4 = Pair.of(node3, node4);
Pair<ResourceNode, ResourceNode> pair3_5 = Pair.makePair(node3, node5); Pair<ResourceNode, ResourceNode> pair3_5 = Pair.of(node3, node5);
Pair<ResourceNode, ResourceNode> pair5_6 = Pair.makePair(node5, node6); Pair<ResourceNode, ResourceNode> pair5_6 = Pair.of(node5, node6);
Pair<ResourceNode, ResourceNode> pair5_7 = Pair.makePair(node5, node7); Pair<ResourceNode, ResourceNode> pair5_7 = Pair.of(node5, node7);
Pair<ResourceNode, ResourceNode> pair7_8 = Pair.makePair(node7, node8); Pair<ResourceNode, ResourceNode> pair7_8 = Pair.of(node7, node8);
Pair<ResourceNode, ResourceNode> pair8_9 = Pair.makePair(node8, node9); Pair<ResourceNode, ResourceNode> pair8_9 = Pair.of(node8, node9);
Pair<ResourceNode, ResourceNode> pair9_10 = Pair.makePair(node9, node10); Pair<ResourceNode, ResourceNode> pair9_10 = Pair.of(node9, node10);
Set<Pair<ResourceNode, ResourceNode>> pairs = JavaUtils Set<Pair<ResourceNode, ResourceNode>> pairs = JavaUtils
.asSet(pair3_4, pair3_5, pair5_6, pair5_7, pair7_8, pair8_9, pair9_10); .asSet(pair3_4, pair3_5, pair5_6, pair5_7, pair7_8, pair8_9, pair9_10);
...@@ -785,11 +785,11 @@ public class InfeasibleEdgePlannerTest { ...@@ -785,11 +785,11 @@ public class InfeasibleEdgePlannerTest {
PlannedEdge edge6_4 = new PlannedEdge(node6, node4, 0); PlannedEdge edge6_4 = new PlannedEdge(node6, node4, 0);
PlannedEdge edge4_3 = new PlannedEdge(node4, node3, 0); PlannedEdge edge4_3 = new PlannedEdge(node4, node3, 0);
Pair<ResourceNode, ResourceNode> pair2_5 = Pair.makePair(node2, node5); Pair<ResourceNode, ResourceNode> pair2_5 = Pair.of(node2, node5);
Pair<ResourceNode, ResourceNode> pair2_6 = Pair.makePair(node2, node6); Pair<ResourceNode, ResourceNode> pair2_6 = Pair.of(node2, node6);
Pair<ResourceNode, ResourceNode> pair5_4 = Pair.makePair(node5, node4); Pair<ResourceNode, ResourceNode> pair5_4 = Pair.of(node5, node4);
Pair<ResourceNode, ResourceNode> pair6_4 = Pair.makePair(node6, node4); Pair<ResourceNode, ResourceNode> pair6_4 = Pair.of(node6, node4);
Pair<ResourceNode, ResourceNode> pair4_3 = Pair.makePair(node4, node3); Pair<ResourceNode, ResourceNode> pair4_3 = Pair.of(node4, node3);
Set<PlannedEdge> edges_using_5_4 = JavaUtils.asSet(edge2_5, edge2_6, edge5_4, edge4_3); Set<PlannedEdge> edges_using_5_4 = JavaUtils.asSet(edge2_5, edge2_6, edge5_4, edge4_3);
Set<PlannedEdge> edges_using_6_4 = JavaUtils.asSet(edge2_5, edge2_6, edge6_4, edge4_3); Set<PlannedEdge> edges_using_6_4 = JavaUtils.asSet(edge2_5, edge2_6, edge6_4, edge4_3);
...@@ -881,11 +881,11 @@ public class InfeasibleEdgePlannerTest { ...@@ -881,11 +881,11 @@ public class InfeasibleEdgePlannerTest {
Set<PlannedEdge> edges = JavaUtils.asSet(edge3_4, edge4_6, edge6_8, edge8_9, edge9_10); Set<PlannedEdge> edges = JavaUtils.asSet(edge3_4, edge4_6, edge6_8, edge8_9, edge9_10);
Pair<ResourceNode, ResourceNode> pair3_4 = Pair.makePair(node3, node4); Pair<ResourceNode, ResourceNode> pair3_4 = Pair.of(node3, node4);
Pair<ResourceNode, ResourceNode> pair4_6 = Pair.makePair(node4, node6); Pair<ResourceNode, ResourceNode> pair4_6 = Pair.of(node4, node6);
Pair<ResourceNode, ResourceNode> pair6_8 = Pair.makePair(node6, node8); Pair<ResourceNode, ResourceNode> pair6_8 = Pair.of(node6, node8);
Pair<ResourceNode, ResourceNode> pair8_9 = Pair.makePair(node8, node9); Pair<ResourceNode, ResourceNode> pair8_9 = Pair.of(node8, node9);
Pair<ResourceNode, ResourceNode> pair9_10 = Pair.makePair(node9, node10); Pair<ResourceNode, ResourceNode> pair9_10 = Pair.of(node9, node10);
Set<Pair<ResourceNode, ResourceNode>> pairs = JavaUtils.asSet(pair3_4, pair4_6, pair6_8, pair8_9, pair9_10); Set<Pair<ResourceNode, ResourceNode>> pairs = JavaUtils.asSet(pair3_4, pair4_6, pair6_8, pair8_9, pair9_10);
...@@ -967,13 +967,13 @@ public class InfeasibleEdgePlannerTest { ...@@ -967,13 +967,13 @@ public class InfeasibleEdgePlannerTest {
Set<PlannedEdge> edges = JavaUtils.asSet(edge3_4, edge4_6, edge4_8, edge6_7, edge8_7, edge7_9, edge9_10); Set<PlannedEdge> edges = JavaUtils.asSet(edge3_4, edge4_6, edge4_8, edge6_7, edge8_7, edge7_9, edge9_10);
Pair<ResourceNode, ResourceNode> pair3_4 = Pair.makePair(node3, node4); Pair<ResourceNode, ResourceNode> pair3_4 = Pair.of(node3, node4);
Pair<ResourceNode, ResourceNode> pair4_6 = Pair.makePair(node4, node6); Pair<ResourceNode, ResourceNode> pair4_6 = Pair.of(node4, node6);
Pair<ResourceNode, ResourceNode> pair4_8 = Pair.makePair(node4, node8); Pair<ResourceNode, ResourceNode> pair4_8 = Pair.of(node4, node8);
Pair<ResourceNode, ResourceNode> pair6_7 = Pair.makePair(node6, node7); Pair<ResourceNode, ResourceNode> pair6_7 = Pair.of(node6, node7);
Pair<ResourceNode, ResourceNode> pair8_7 = Pair.makePair(node8, node7); Pair<ResourceNode, ResourceNode> pair8_7 = Pair.of(node8, node7);
Pair<ResourceNode, ResourceNode> pair7_9 = Pair.makePair(node7, node9); Pair<ResourceNode, ResourceNode> pair7_9 = Pair.of(node7, node9);
Pair<ResourceNode, ResourceNode> pair9_10 = Pair.makePair(node9, node10); Pair<ResourceNode, ResourceNode> pair9_10 = Pair.of(node9, node10);
Set<Pair<ResourceNode, ResourceNode>> pairs = JavaUtils Set<Pair<ResourceNode, ResourceNode>> pairs = JavaUtils
.asSet(pair3_4, pair4_6, pair4_8, pair6_7, pair8_7, pair7_9, pair9_10); .asSet(pair3_4, pair4_6, pair4_8, pair6_7, pair8_7, pair7_9, pair9_10);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment