mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[vcs-log] minor: remove duplication
This commit is contained in:
+10
-13
@@ -37,6 +37,7 @@ import java.util.Set;
|
||||
class LinearBekGraphBuilder {
|
||||
private static final int MAX_BLOCK_SIZE = 200;
|
||||
private static final int MAGIC_SET_SIZE = PrintElementGeneratorImpl.LONG_EDGE_SIZE;
|
||||
private static final GraphEdgeToDownNode GRAPH_EDGE_TO_DOWN_NODE = new GraphEdgeToDownNode();
|
||||
@NotNull private final GraphLayout myGraphLayout;
|
||||
private final LinearBekGraph myLinearBekGraph;
|
||||
|
||||
@@ -181,23 +182,12 @@ class LinearBekGraphBuilder {
|
||||
magicSet = ContainerUtil.newHashSet(MAGIC_SET_SIZE);
|
||||
|
||||
PriorityQueue<Integer> magicQueue = new PriorityQueue<Integer>(MAGIC_SET_SIZE);
|
||||
magicQueue
|
||||
.addAll(ContainerUtil.map(myLinearBekGraph.getAdjacentEdges(node, EdgeFilter.NORMAL_DOWN), new Function<GraphEdge, Integer>() {
|
||||
@Override
|
||||
public Integer fun(GraphEdge graphEdge) {
|
||||
return graphEdge.getDownNodeIndex();
|
||||
}
|
||||
}));
|
||||
magicQueue.addAll(ContainerUtil.map(myLinearBekGraph.getAdjacentEdges(node, EdgeFilter.NORMAL_DOWN), GRAPH_EDGE_TO_DOWN_NODE));
|
||||
while (!magicQueue.isEmpty()) {
|
||||
Integer i = magicQueue.poll();
|
||||
if (i > node + MAGIC_SET_SIZE) break;
|
||||
magicSet.add(i);
|
||||
magicQueue.addAll(ContainerUtil.map(myLinearBekGraph.getAdjacentEdges(i, EdgeFilter.NORMAL_DOWN), new Function<GraphEdge, Integer>() {
|
||||
@Override
|
||||
public Integer fun(GraphEdge graphEdge) {
|
||||
return graphEdge.getDownNodeIndex();
|
||||
}
|
||||
}));
|
||||
magicQueue.addAll(ContainerUtil.map(myLinearBekGraph.getAdjacentEdges(i, EdgeFilter.NORMAL_DOWN), GRAPH_EDGE_TO_DOWN_NODE));
|
||||
}
|
||||
return magicSet;
|
||||
}
|
||||
@@ -326,4 +316,11 @@ class LinearBekGraphBuilder {
|
||||
return d1.compareTo(d2);
|
||||
}
|
||||
}
|
||||
|
||||
private static class GraphEdgeToDownNode implements Function<GraphEdge, Integer> {
|
||||
@Override
|
||||
public Integer fun(GraphEdge graphEdge) {
|
||||
return graphEdge.getDownNodeIndex();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user