Commit e89fbf89 authored by Sebastian Vollbrecht's avatar Sebastian Vollbrecht

Renamed a method.

parent 2cd22311
......@@ -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
* static {@link Pair#makePair(Object, Object)} constructor.
* static {@link Pair#of(Object, Object)} constructor.
*
* @param <T1> the type of the first element
* @param <T2> the type of the second element
......@@ -54,7 +54,7 @@ public class Pair<T1, T2> {
* @return a (first, second) pair
* @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);
}
......
......@@ -419,7 +419,7 @@ public final class GraphGenerator {
optimalCandidatesFound = true;
}
possibleCandidates.add(Pair.makePair(src, delay));
possibleCandidates.add(Pair.of(src, delay));
if (verbose) {
out.println("optimal.");
......@@ -431,7 +431,7 @@ public final class GraphGenerator {
}
if (!optimalCandidatesFound) {
possibleCandidates.add(Pair.makePair(src, delay));
possibleCandidates.add(Pair.of(src, delay));
}
}
}
......@@ -514,7 +514,7 @@ public final class GraphGenerator {
optimalCandidatesFound = true;
}
possibleCandidates.add(Pair.makePair(dst, delay));
possibleCandidates.add(Pair.of(dst, delay));
if (verbose) {
out.println("optimal.");
......@@ -525,7 +525,7 @@ public final class GraphGenerator {
}
if (!optimalCandidatesFound) {
possibleCandidates.add(Pair.makePair(dst, delay));
possibleCandidates.add(Pair.of(dst, delay));
}
}
}
......
......@@ -70,7 +70,7 @@ public class DepthValueComputer extends ValueComputer {
this.depthsAndValueComputers = new ArrayList<>();
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));
}
......
......@@ -74,7 +74,7 @@ public class DepthEdgeIncluder extends EdgeIncluder {
this.depthsAndEdgeIncluders = new ArrayList<>();
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));
}
......
......@@ -66,7 +66,7 @@ public class DepthNodeCreator extends NodeCreator {
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));
}
......
......@@ -413,7 +413,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 {
Set<ResourceNode> predecessors = getPossiblePredecessors(fixedNode, startCfg, infeasibleCfg);
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);
......@@ -143,7 +143,7 @@ public class InfeasibleEdgePlanner {
if (i == 0) {
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);
......@@ -156,7 +156,7 @@ public class InfeasibleEdgePlanner {
} else {
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);
......
......@@ -149,7 +149,7 @@ public class DepthIterator<N extends Node> implements Iterator<Pair<Double, Set<
@Override
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();
return currentPair;
......
......@@ -1221,7 +1221,7 @@ public class GraphUtils {
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.get(delLimPair).add(r);
......@@ -1241,7 +1241,7 @@ public class GraphUtils {
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.get(delLimPair).add(r);
......
......@@ -424,11 +424,11 @@ public class InfeasibleEdgePlannerTest {
InfeasibleEdgePlanner planner = new InfeasibleEdgePlanner(startCfg, infeasibleCfg, suffixCfg, rng);
Pair<ResourceNode, ResourceNode> pair3_4 = Pair.makePair(node3, node4);
Pair<ResourceNode, ResourceNode> pair3_5 = Pair.makePair(node3, node5);
Pair<ResourceNode, ResourceNode> pair5_6 = Pair.makePair(node5, node6);
Pair<ResourceNode, ResourceNode> pair5_7 = Pair.makePair(node5, node7);
Pair<ResourceNode, ResourceNode> pair7_8 = Pair.makePair(node7, node8);
Pair<ResourceNode, ResourceNode> pair3_4 = Pair.of(node3, node4);
Pair<ResourceNode, ResourceNode> pair3_5 = Pair.of(node3, node5);
Pair<ResourceNode, ResourceNode> pair5_6 = Pair.of(node5, node6);
Pair<ResourceNode, ResourceNode> pair5_7 = Pair.of(node5, node7);
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);
......@@ -493,13 +493,13 @@ public class InfeasibleEdgePlannerTest {
InfeasibleEdgePlanner planner = new InfeasibleEdgePlanner(startCfg, infeasibleCfg, suffixCfg, rng);
Pair<ResourceNode, ResourceNode> pair3_4 = Pair.makePair(node3, node4);
Pair<ResourceNode, ResourceNode> pair3_5 = Pair.makePair(node3, node5);
Pair<ResourceNode, ResourceNode> pair5_6 = Pair.makePair(node5, node6);
Pair<ResourceNode, ResourceNode> pair5_7 = Pair.makePair(node5, node7);
Pair<ResourceNode, ResourceNode> pair7_8 = Pair.makePair(node7, node8);
Pair<ResourceNode, ResourceNode> pair8_9 = Pair.makePair(node8, node9);
Pair<ResourceNode, ResourceNode> pair9_10 = Pair.makePair(node9, node10);
Pair<ResourceNode, ResourceNode> pair3_4 = Pair.of(node3, node4);
Pair<ResourceNode, ResourceNode> pair3_5 = Pair.of(node3, node5);
Pair<ResourceNode, ResourceNode> pair5_6 = Pair.of(node5, node6);
Pair<ResourceNode, ResourceNode> pair5_7 = Pair.of(node5, node7);
Pair<ResourceNode, ResourceNode> pair7_8 = Pair.of(node7, node8);
Pair<ResourceNode, ResourceNode> pair8_9 = Pair.of(node8, node9);
Pair<ResourceNode, ResourceNode> pair9_10 = Pair.of(node9, node10);
Set<Pair<ResourceNode, ResourceNode>> pairs = JavaUtils
.asSet(pair3_4, pair3_5, pair5_6, pair5_7, pair7_8, pair8_9, pair9_10);
......@@ -562,9 +562,9 @@ public class InfeasibleEdgePlannerTest {
InfeasibleEdgePlanner planner = new InfeasibleEdgePlanner(startCfg, infeasibleCfg, suffixCfg, rng);
Pair<ResourceNode, ResourceNode> pair3_4 = Pair.makePair(node3, node4);
Pair<ResourceNode, ResourceNode> pair4_6 = Pair.makePair(node4, node6);
Pair<ResourceNode, ResourceNode> pair6_8 = Pair.makePair(node6, node8);
Pair<ResourceNode, ResourceNode> pair3_4 = Pair.of(node3, node4);
Pair<ResourceNode, ResourceNode> pair4_6 = Pair.of(node4, node6);
Pair<ResourceNode, ResourceNode> pair6_8 = Pair.of(node6, node8);
Set<Pair<ResourceNode, ResourceNode>> pairs = JavaUtils.asSet(pair3_4, pair4_6, pair6_8);
......@@ -626,10 +626,10 @@ public class InfeasibleEdgePlannerTest {
InfeasibleEdgePlanner planner = new InfeasibleEdgePlanner(startCfg, infeasibleCfg, suffixCfg, rng);
Pair<ResourceNode, ResourceNode> pair3_4 = Pair.makePair(node3, node4);
Pair<ResourceNode, ResourceNode> pair4_6 = Pair.makePair(node4, node6);
Pair<ResourceNode, ResourceNode> pair6_8 = Pair.makePair(node6, node8);
Pair<ResourceNode, ResourceNode> pair8_9 = Pair.makePair(node8, node9);
Pair<ResourceNode, ResourceNode> pair3_4 = Pair.of(node3, node4);
Pair<ResourceNode, ResourceNode> pair4_6 = Pair.of(node4, node6);
Pair<ResourceNode, ResourceNode> pair6_8 = Pair.of(node6, node8);
Pair<ResourceNode, ResourceNode> pair8_9 = Pair.of(node8, node9);
Set<Pair<ResourceNode, ResourceNode>> pairs = JavaUtils.asSet(pair3_4, pair4_6, pair6_8, pair8_9);
......@@ -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);
Pair<ResourceNode, ResourceNode> pair3_4 = Pair.makePair(node3, node4);
Pair<ResourceNode, ResourceNode> pair3_5 = Pair.makePair(node3, node5);
Pair<ResourceNode, ResourceNode> pair5_6 = Pair.makePair(node5, node6);
Pair<ResourceNode, ResourceNode> pair5_7 = Pair.makePair(node5, node7);
Pair<ResourceNode, ResourceNode> pair7_8 = Pair.makePair(node7, node8);
Pair<ResourceNode, ResourceNode> pair8_9 = Pair.makePair(node8, node9);
Pair<ResourceNode, ResourceNode> pair9_10 = Pair.makePair(node9, node10);
Pair<ResourceNode, ResourceNode> pair3_4 = Pair.of(node3, node4);
Pair<ResourceNode, ResourceNode> pair3_5 = Pair.of(node3, node5);
Pair<ResourceNode, ResourceNode> pair5_6 = Pair.of(node5, node6);
Pair<ResourceNode, ResourceNode> pair5_7 = Pair.of(node5, node7);
Pair<ResourceNode, ResourceNode> pair7_8 = Pair.of(node7, node8);
Pair<ResourceNode, ResourceNode> pair8_9 = Pair.of(node8, node9);
Pair<ResourceNode, ResourceNode> pair9_10 = Pair.of(node9, node10);
Set<Pair<ResourceNode, ResourceNode>> pairs = JavaUtils
.asSet(pair3_4, pair3_5, pair5_6, pair5_7, pair7_8, pair8_9, pair9_10);
......@@ -785,11 +785,11 @@ public class InfeasibleEdgePlannerTest {
PlannedEdge edge6_4 = new PlannedEdge(node6, node4, 0);
PlannedEdge edge4_3 = new PlannedEdge(node4, node3, 0);
Pair<ResourceNode, ResourceNode> pair2_5 = Pair.makePair(node2, node5);
Pair<ResourceNode, ResourceNode> pair2_6 = Pair.makePair(node2, node6);
Pair<ResourceNode, ResourceNode> pair5_4 = Pair.makePair(node5, node4);
Pair<ResourceNode, ResourceNode> pair6_4 = Pair.makePair(node6, node4);
Pair<ResourceNode, ResourceNode> pair4_3 = Pair.makePair(node4, node3);
Pair<ResourceNode, ResourceNode> pair2_5 = Pair.of(node2, node5);
Pair<ResourceNode, ResourceNode> pair2_6 = Pair.of(node2, node6);
Pair<ResourceNode, ResourceNode> pair5_4 = Pair.of(node5, node4);
Pair<ResourceNode, ResourceNode> pair6_4 = Pair.of(node6, node4);
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_6_4 = JavaUtils.asSet(edge2_5, edge2_6, edge6_4, edge4_3);
......@@ -881,11 +881,11 @@ public class InfeasibleEdgePlannerTest {
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> pair4_6 = Pair.makePair(node4, node6);
Pair<ResourceNode, ResourceNode> pair6_8 = Pair.makePair(node6, node8);
Pair<ResourceNode, ResourceNode> pair8_9 = Pair.makePair(node8, node9);
Pair<ResourceNode, ResourceNode> pair9_10 = Pair.makePair(node9, node10);
Pair<ResourceNode, ResourceNode> pair3_4 = Pair.of(node3, node4);
Pair<ResourceNode, ResourceNode> pair4_6 = Pair.of(node4, node6);
Pair<ResourceNode, ResourceNode> pair6_8 = Pair.of(node6, node8);
Pair<ResourceNode, ResourceNode> pair8_9 = Pair.of(node8, node9);
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);
......@@ -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);
Pair<ResourceNode, ResourceNode> pair3_4 = Pair.makePair(node3, node4);
Pair<ResourceNode, ResourceNode> pair4_6 = Pair.makePair(node4, node6);
Pair<ResourceNode, ResourceNode> pair4_8 = Pair.makePair(node4, node8);
Pair<ResourceNode, ResourceNode> pair6_7 = Pair.makePair(node6, node7);
Pair<ResourceNode, ResourceNode> pair8_7 = Pair.makePair(node8, node7);
Pair<ResourceNode, ResourceNode> pair7_9 = Pair.makePair(node7, node9);
Pair<ResourceNode, ResourceNode> pair9_10 = Pair.makePair(node9, node10);
Pair<ResourceNode, ResourceNode> pair3_4 = Pair.of(node3, node4);
Pair<ResourceNode, ResourceNode> pair4_6 = Pair.of(node4, node6);
Pair<ResourceNode, ResourceNode> pair4_8 = Pair.of(node4, node8);
Pair<ResourceNode, ResourceNode> pair6_7 = Pair.of(node6, node7);
Pair<ResourceNode, ResourceNode> pair8_7 = Pair.of(node8, node7);
Pair<ResourceNode, ResourceNode> pair7_9 = Pair.of(node7, node9);
Pair<ResourceNode, ResourceNode> pair9_10 = Pair.of(node9, node10);
Set<Pair<ResourceNode, ResourceNode>> pairs = JavaUtils
.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