diff --git a/platform/vcs-log/graph/src/META-INF/vcs-log-graph.xml b/platform/vcs-log/graph/src/META-INF/vcs-log-graph.xml
index e47aba567a6f..148291f2aa83 100644
--- a/platform/vcs-log/graph/src/META-INF/vcs-log-graph.xml
+++ b/platform/vcs-log/graph/src/META-INF/vcs-log-graph.xml
@@ -2,7 +2,7 @@
+ serviceImplementation="com.intellij.vcs.log.graph.PermanentGraphBuilderImpl"/>
diff --git a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/GraphCommitImpl.java b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/GraphCommitImpl.java
index a8b3dcfc0027..6ddfd98bdad6 100644
--- a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/GraphCommitImpl.java
+++ b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/GraphCommitImpl.java
@@ -21,7 +21,7 @@ import org.jetbrains.annotations.NotNull;
import java.util.List;
-public class GraphCommitImpl extends ImmutableList implements GraphCommit{
+public class GraphCommitImpl extends ImmutableList implements GraphCommit {
@NotNull private final CommitId myId;
@NotNull private final Object myParents;
@@ -32,10 +32,12 @@ public class GraphCommitImpl extends ImmutableList implement
myTimestamp = timestamp;
if (parents.isEmpty()) {
myParents = ArrayUtil.EMPTY_OBJECT_ARRAY;
- } else if (parents.size() == 1) {
+ }
+ else if (parents.size() == 1) {
myParents = parents.get(0);
assert !(myParents instanceof Object[]);
- } else {
+ }
+ else {
myParents = parents.toArray();
}
}
diff --git a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/api/GraphLayout.java b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/api/GraphLayout.java
index d0e5d0728497..2a2a03e417a3 100644
--- a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/api/GraphLayout.java
+++ b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/api/GraphLayout.java
@@ -26,6 +26,9 @@ public interface GraphLayout {
// nodeIndex must be in [0..graph.nodesCount() - 1]
int getLayoutIndex(int nodeIndex);
+
int getOneOfHeadNodeIndex(int nodeIndex);
- @NotNull List getHeadNodeIndex();
+
+ @NotNull
+ List getHeadNodeIndex();
}
diff --git a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/api/LiteLinearGraph.java b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/api/LiteLinearGraph.java
index a24906a14638..dca4ee1592f6 100644
--- a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/api/LiteLinearGraph.java
+++ b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/api/LiteLinearGraph.java
@@ -19,9 +19,7 @@ import org.jetbrains.annotations.NotNull;
import java.util.List;
-import static com.intellij.vcs.log.graph.api.EdgeFilter.NORMAL_ALL;
-import static com.intellij.vcs.log.graph.api.EdgeFilter.NORMAL_DOWN;
-import static com.intellij.vcs.log.graph.api.EdgeFilter.NORMAL_UP;
+import static com.intellij.vcs.log.graph.api.EdgeFilter.*;
public interface LiteLinearGraph {
int nodesCount();
@@ -36,8 +34,7 @@ public interface LiteLinearGraph {
public final boolean up;
public final boolean down;
- @NotNull
- public final EdgeFilter edgeFilter;
+ @NotNull public final EdgeFilter edgeFilter;
NodeFilter(boolean up, boolean down, @NotNull EdgeFilter edgeFilter) {
this.up = up;
diff --git a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/api/permanent/PermanentGraphInfo.java b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/api/permanent/PermanentGraphInfo.java
index 3a0fe3f943f5..0a70e69e0624 100644
--- a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/api/permanent/PermanentGraphInfo.java
+++ b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/api/permanent/PermanentGraphInfo.java
@@ -17,7 +17,6 @@ package com.intellij.vcs.log.graph.api.permanent;
import com.intellij.vcs.log.graph.GraphColorManager;
import com.intellij.vcs.log.graph.api.GraphLayout;
-import com.intellij.vcs.log.graph.api.LinearGraph;
import com.intellij.vcs.log.graph.impl.permanent.PermanentLinearGraphImpl;
import org.jetbrains.annotations.NotNull;
diff --git a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/collapsing/BranchMatchedNodesGenerator.java b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/collapsing/BranchMatchedNodesGenerator.java
index 54df74cd8415..7bbf26634cb7 100644
--- a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/collapsing/BranchMatchedNodesGenerator.java
+++ b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/collapsing/BranchMatchedNodesGenerator.java
@@ -28,7 +28,8 @@ import java.util.Set;
public class BranchMatchedNodesGenerator {
@NotNull
- public static UnsignedBitSet generateVisibleNodes(@NotNull PermanentLinearGraphImpl permanentGraph, @Nullable Set headNodeIndexes) {
+ public static UnsignedBitSet generateVisibleNodes(@NotNull PermanentLinearGraphImpl permanentGraph,
+ @Nullable Set headNodeIndexes) {
if (headNodeIndexes == null) {
UnsignedBitSet nodesVisibility = new UnsignedBitSet();
nodesVisibility.set(0, permanentGraph.nodesCount() - 1, true);
@@ -41,14 +42,11 @@ public class BranchMatchedNodesGenerator {
return generator.myNodesVisibility;
}
- @NotNull
- private final LiteLinearGraph myGraph;
+ @NotNull private final LiteLinearGraph myGraph;
- @NotNull
- private final UnsignedBitSet myNodesVisibility;
+ @NotNull private final UnsignedBitSet myNodesVisibility;
- @NotNull
- private final DfsUtil myDfsUtil = new DfsUtil();
+ @NotNull private final DfsUtil myDfsUtil = new DfsUtil();
BranchMatchedNodesGenerator(@NotNull LiteLinearGraph graph) {
myGraph = graph;
diff --git a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/collapsing/DottedFilterEdgesGenerator.java b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/collapsing/DottedFilterEdgesGenerator.java
index e855e9103228..d2e862a09360 100644
--- a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/collapsing/DottedFilterEdgesGenerator.java
+++ b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/collapsing/DottedFilterEdgesGenerator.java
@@ -40,7 +40,10 @@ public class DottedFilterEdgesGenerator {
private final int myDownIndex;
@NotNull private final ShiftNumber myNumbers;
- private DottedFilterEdgesGenerator(@NotNull CollapsedGraph collapsedGraph, @NotNull CollapsedGraph.Modification modification, int upIndex, int downIndex) {
+ private DottedFilterEdgesGenerator(@NotNull CollapsedGraph collapsedGraph,
+ @NotNull CollapsedGraph.Modification modification,
+ int upIndex,
+ int downIndex) {
myCollapsedGraph = collapsedGraph;
myModification = modification;
myLiteDelegateGraph = LinearGraphUtils.asLiteLinearGraph(collapsedGraph.getDelegatedGraph());
@@ -99,19 +102,23 @@ public class DottedFilterEdgesGenerator {
continue;
}
- if (nodeIsVisible(upNode))
+ if (nodeIsVisible(upNode)) {
maxAdjNumber = Math.max(maxAdjNumber, myNumbers.getNumber(upNode));
- else
+ }
+ else {
nearlyUp = Math.max(nearlyUp, myNumbers.getNumber(upNode));
+ }
}
if (nearlyUp == maxAdjNumber || nearlyUp == Integer.MIN_VALUE) {
myNumbers.setNumber(currentNodeIndex, maxAdjNumber);
- } else {
+ }
+ else {
addDottedEdge(currentNodeIndex, nearlyUp);
myNumbers.setNumber(currentNodeIndex, nearlyUp);
}
- } else {
+ }
+ else {
// node currentNodeIndex invisible
int nearlyUp = Integer.MIN_VALUE;
@@ -139,19 +146,23 @@ public class DottedFilterEdgesGenerator {
continue;
}
- if (nodeIsVisible(downNode))
+ if (nodeIsVisible(downNode)) {
minAdjNumber = Math.min(minAdjNumber, myNumbers.getNumber(downNode));
- else
+ }
+ else {
nearlyDown = Math.min(nearlyDown, myNumbers.getNumber(downNode));
+ }
}
if (nearlyDown == minAdjNumber || nearlyDown == Integer.MAX_VALUE) {
myNumbers.setNumber(currentNodeIndex, minAdjNumber);
- } else {
+ }
+ else {
addDottedEdge(currentNodeIndex, nearlyDown);
myNumbers.setNumber(currentNodeIndex, nearlyDown);
}
- } else {
+ }
+ else {
// node currentNodeIndex invisible
int nearlyDown = Integer.MAX_VALUE;
@@ -169,7 +180,6 @@ public class DottedFilterEdgesGenerator {
}
-
static class ShiftNumber {
private final int startIndex;
private final int endIndex;
diff --git a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/collapsing/EdgeStorageWrapper.java b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/collapsing/EdgeStorageWrapper.java
index 6808365672cd..8095e34a10be 100644
--- a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/collapsing/EdgeStorageWrapper.java
+++ b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/collapsing/EdgeStorageWrapper.java
@@ -15,7 +15,6 @@
*/
package com.intellij.vcs.log.graph.collapsing;
-import com.intellij.openapi.util.Condition;
import com.intellij.openapi.util.Pair;
import com.intellij.util.Function;
import com.intellij.util.containers.ContainerUtil;
@@ -23,7 +22,6 @@ import com.intellij.vcs.log.graph.api.EdgeFilter;
import com.intellij.vcs.log.graph.api.LinearGraph;
import com.intellij.vcs.log.graph.api.elements.GraphEdge;
import com.intellij.vcs.log.graph.api.elements.GraphEdgeType;
-import com.intellij.vcs.log.graph.utils.LinearGraphUtils;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -130,10 +128,12 @@ public class EdgeStorageWrapper {
private static boolean matchedEdge(int startNodeIndex, @Nullable GraphEdge edge, @NotNull EdgeFilter filter) {
if (edge == null) return false;
if (edge.getType().isNormalEdge()) {
- return (startNodeIndex == convertToInt(edge.getDownNodeIndex()) && filter.upNormal)
- || (startNodeIndex == convertToInt(edge.getUpNodeIndex()) && filter.downNormal);
+ return (startNodeIndex == convertToInt(edge.getDownNodeIndex()) && filter.upNormal) ||
+ (startNodeIndex == convertToInt(edge.getUpNodeIndex()) && filter.downNormal);
+ }
+ else {
+ return filter.special;
}
- else return filter.special;
}
private static int convertToInt(@Nullable Integer value) {
diff --git a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/collapsing/FragmentGenerator.java b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/collapsing/FragmentGenerator.java
index 029d1bffb639..8bb161ea71dd 100644
--- a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/collapsing/FragmentGenerator.java
+++ b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/collapsing/FragmentGenerator.java
@@ -21,14 +21,17 @@ import com.intellij.vcs.log.graph.api.LiteLinearGraph;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
-import java.util.*;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
public class FragmentGenerator {
public static class GreenFragment {
@Nullable private final Integer myUpRedNode;
@Nullable private final Integer myDownRedNode;
- @NotNull private final Set myMiddleGreenNodes;
+ @NotNull private final Set myMiddleGreenNodes;
private GreenFragment(@Nullable Integer upRedNode, @Nullable Integer downRedNode, @NotNull Set middleGreenNodes) {
myUpRedNode = upRedNode;
@@ -52,10 +55,8 @@ public class FragmentGenerator {
}
}
- @NotNull
- private final LiteLinearGraph myGraph;
- @NotNull
- private final Condition myRedNodes;
+ @NotNull private final LiteLinearGraph myGraph;
+ @NotNull private final Condition myRedNodes;
public FragmentGenerator(@NotNull LiteLinearGraph graph, @NotNull Condition redNodes) {
myGraph = graph;
@@ -110,13 +111,11 @@ public class FragmentGenerator {
Integer upRedNode = getNearRedNode(startNode, maxWalkSize, true);
Integer downRedNode = getNearRedNode(startNode, maxWalkSize, false);
- Set upPart = upRedNode != null ?
- getMiddleNodes(upRedNode, startNode, false) :
- getWalkNodes(startNode, true, createStopFunction(maxWalkSize));
+ Set upPart =
+ upRedNode != null ? getMiddleNodes(upRedNode, startNode, false) : getWalkNodes(startNode, true, createStopFunction(maxWalkSize));
- Set downPart = downRedNode != null ?
- getMiddleNodes(startNode, downRedNode, false) :
- getWalkNodes(startNode, false, createStopFunction(maxWalkSize));
+ Set downPart =
+ downRedNode != null ? getMiddleNodes(startNode, downRedNode, false) : getWalkNodes(startNode, false, createStopFunction(maxWalkSize));
Set middleNodes = ContainerUtil.union(upPart, downPart);
if (upRedNode != null) middleNodes.remove(upRedNode);
@@ -150,6 +149,7 @@ public class FragmentGenerator {
private static Condition createStopFunction(final int maxNodeCount) {
return new Condition() {
private int count = maxNodeCount;
+
@Override
public boolean value(Integer integer) {
count--;
diff --git a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/collapsing/TreeSetNodeIterator.java b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/collapsing/TreeSetNodeIterator.java
index dba38e77d986..185602af482b 100644
--- a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/collapsing/TreeSetNodeIterator.java
+++ b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/collapsing/TreeSetNodeIterator.java
@@ -29,8 +29,7 @@ class TreeSetNodeIterator {
myWalkNodes = new TreeSet(new Comparator() {
@Override
public int compare(@NotNull Integer o1, @NotNull Integer o2) {
- if (isUp)
- return o2 - o1;
+ if (isUp) return o2 - o1;
return o1 - o2;
}
});
diff --git a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/facade/BekBaseLinearGraphController.java b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/facade/BekBaseLinearGraphController.java
index a1b2101c55d8..d72c4a25a400 100644
--- a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/facade/BekBaseLinearGraphController.java
+++ b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/facade/BekBaseLinearGraphController.java
@@ -33,10 +33,8 @@ import java.util.List;
import static com.intellij.util.containers.ContainerUtil.map;
public class BekBaseLinearGraphController extends CascadeLinearGraphController {
- @NotNull
- private final BekIntMap myBekIntMap;
- @NotNull
- private final LinearGraph myBekGraph;
+ @NotNull private final BekIntMap myBekIntMap;
+ @NotNull private final LinearGraph myBekGraph;
public BekBaseLinearGraphController(@NotNull PermanentGraphInfo permanentGraphInfo, @NotNull BekIntMap bekIntMap) {
super(null, permanentGraphInfo);
@@ -72,8 +70,10 @@ public class BekBaseLinearGraphController extends CascadeLinearGraphController {
Integer convertedUpIndex = upIndex == null ? null : myBekIntMap.getUsualIndex(upIndex);
Integer convertedDownIndex = downIndex == null ? null : myBekIntMap.getUsualIndex(downIndex);
- return new GraphEdge(convertedUpIndex, convertedDownIndex, ((GraphEdge)graphElement).getTargetId(), ((GraphEdge)graphElement).getType());
- } else if (graphElement instanceof GraphNode) {
+ return new GraphEdge(convertedUpIndex, convertedDownIndex, ((GraphEdge)graphElement).getTargetId(),
+ ((GraphEdge)graphElement).getType());
+ }
+ else if (graphElement instanceof GraphNode) {
return new GraphNode(myBekIntMap.getUsualIndex((((GraphNode)graphElement).getNodeIndex())), ((GraphNode)graphElement).getType());
}
return null;
@@ -86,8 +86,7 @@ public class BekBaseLinearGraphController extends CascadeLinearGraphController {
}
private class BekLinearGraph implements LinearGraph {
- @NotNull
- private final LinearGraph myPermanentGraph;
+ @NotNull private final LinearGraph myPermanentGraph;
private BekLinearGraph() {
myPermanentGraph = myPermanentGraphInfo.getPermanentLinearGraph();
@@ -111,7 +110,8 @@ public class BekBaseLinearGraphController extends CascadeLinearGraphController {
return map(myPermanentGraph.getAdjacentEdges(myBekIntMap.getUsualIndex(nodeIndex), filter), new Function() {
@Override
public GraphEdge fun(GraphEdge edge) {
- return new GraphEdge(getNodeIndex(edge.getUpNodeIndex()), getNodeIndex(edge.getDownNodeIndex()), edge.getTargetId(), edge.getType());
+ return new GraphEdge(getNodeIndex(edge.getUpNodeIndex()), getNodeIndex(edge.getDownNodeIndex()), edge.getTargetId(),
+ edge.getType());
}
});
}
diff --git a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/facade/CascadeLinearGraphController.java b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/facade/CascadeLinearGraphController.java
index cd7b5af6737d..0e22f6985108 100644
--- a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/facade/CascadeLinearGraphController.java
+++ b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/facade/CascadeLinearGraphController.java
@@ -23,10 +23,8 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public abstract class CascadeLinearGraphController implements LinearGraphController {
- @Nullable
- private final CascadeLinearGraphController myDelegateLinearGraphController;
- @NotNull
- protected final PermanentGraphInfo myPermanentGraphInfo;
+ @Nullable private final CascadeLinearGraphController myDelegateLinearGraphController;
+ @NotNull protected final PermanentGraphInfo myPermanentGraphInfo;
protected CascadeLinearGraphController(@Nullable CascadeLinearGraphController delegateLinearGraphController,
@NotNull PermanentGraphInfo permanentGraphInfo) {
@@ -39,12 +37,11 @@ public abstract class CascadeLinearGraphController implements LinearGraphControl
public LinearGraphAnswer performLinearGraphAction(@NotNull LinearGraphAction action) {
LinearGraphAnswer answer = performAction(action);
if (answer == null && myDelegateLinearGraphController != null) {
- answer = myDelegateLinearGraphController.performLinearGraphAction(new VisibleGraphImpl.LinearGraphActionImpl(
- convertToDelegate(action.getAffectedElement()), action.getType()));
+ answer = myDelegateLinearGraphController.performLinearGraphAction(
+ new VisibleGraphImpl.LinearGraphActionImpl(convertToDelegate(action.getAffectedElement()), action.getType()));
answer = delegateGraphChanged(answer);
}
- if (answer != null)
- return answer;
+ if (answer != null) return answer;
return LinearGraphUtils.DEFAULT_GRAPH_ANSWER;
}
diff --git a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/facade/ContainingBranchesGetter.java b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/facade/ContainingBranchesGetter.java
index 9638b4604bf6..3a9a25fdf7b6 100644
--- a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/facade/ContainingBranchesGetter.java
+++ b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/facade/ContainingBranchesGetter.java
@@ -26,20 +26,15 @@ import java.util.HashSet;
import java.util.Set;
public class ContainingBranchesGetter {
- @NotNull
- private final LiteLinearGraph myGraph;
+ @NotNull private final LiteLinearGraph myGraph;
- @NotNull
- private final Set myBranchNodeIndexes;
+ @NotNull private final Set myBranchNodeIndexes;
- @NotNull
- private final DfsUtil myDfsUtil = new DfsUtil();
+ @NotNull private final DfsUtil myDfsUtil = new DfsUtil();
- @NotNull
- private final Flags myTempFlags;
+ @NotNull private final Flags myTempFlags;
- public ContainingBranchesGetter(@NotNull LiteLinearGraph graph,
- @NotNull Set branchNodeIndexes) {
+ public ContainingBranchesGetter(@NotNull LiteLinearGraph graph, @NotNull Set branchNodeIndexes) {
myGraph = graph;
myBranchNodeIndexes = branchNodeIndexes;
myTempFlags = new BitSetFlags(graph.nodesCount());
@@ -70,7 +65,6 @@ public class ContainingBranchesGetter {
}
private void checkAndAdd(int nodeIndex, Set result) {
- if (myBranchNodeIndexes.contains(nodeIndex))
- result.add(nodeIndex);
+ if (myBranchNodeIndexes.contains(nodeIndex)) result.add(nodeIndex);
}
}
diff --git a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/facade/LinearGraphController.java b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/facade/LinearGraphController.java
index 159482a9f475..1271f1d11ad5 100644
--- a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/facade/LinearGraphController.java
+++ b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/facade/LinearGraphController.java
@@ -18,7 +18,6 @@ package com.intellij.vcs.log.graph.impl.facade;
import com.intellij.vcs.log.graph.actions.GraphAction;
import com.intellij.vcs.log.graph.actions.GraphAnswer;
import com.intellij.vcs.log.graph.api.LinearGraph;
-import com.intellij.vcs.log.graph.collapsing.CollapsedGraph;
import com.intellij.vcs.log.graph.impl.print.elements.PrintElementWithGraphElement;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
diff --git a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/facade/PrintElementManagerImpl.java b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/facade/PrintElementManagerImpl.java
index ab6ecf93912c..53d17f5daa86 100644
--- a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/facade/PrintElementManagerImpl.java
+++ b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/facade/PrintElementManagerImpl.java
@@ -48,8 +48,7 @@ class PrintElementManagerImpl implements PrintElementManager {
@Override
public Integer fun(Integer nodeIndex) {
int nodeId = linearGraph.getNodeId(nodeIndex);
- if (nodeId < 0)
- return nodeId;
+ if (nodeId < 0) return nodeId;
return myPermanentGraph.getPermanentGraphLayout().getLayoutIndex(nodeId);
}
});
diff --git a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/facade/bek/BekBranch.java b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/facade/bek/BekBranch.java
index e508af4e0e9f..764b1e09bee7 100644
--- a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/facade/bek/BekBranch.java
+++ b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/facade/bek/BekBranch.java
@@ -31,15 +31,12 @@ class BekBranch {
private static final int SMALL_DELTA_TIME = 60 * 60 * 4 * 1000;
- @NotNull
- private final LinearGraph myPermanentGraph;
- @NotNull
- private final List myNodeIndexes;
+ @NotNull private final LinearGraph myPermanentGraph;
+ @NotNull private final List myNodeIndexes;
private int myNoInsertSize;
- @Nullable
- private List myPrepareForInsertPart = null;
+ @Nullable private List myPrepareForInsertPart = null;
public BekBranch(@NotNull LinearGraph permanentGraph, @NotNull List nodeIndexes) {
myPermanentGraph = permanentGraph;
@@ -51,8 +48,7 @@ class BekBranch {
assert myPrepareForInsertPart == null;
int currentNode = myNodeIndexes.get(myNoInsertSize - 1);
- if (edgeRestrictions.hasRestriction(currentNode))
- return;
+ if (edgeRestrictions.hasRestriction(currentNode)) return;
int prevIndex;
for (prevIndex = myNoInsertSize - 1; prevIndex > 0; prevIndex--) {
@@ -60,27 +56,22 @@ class BekBranch {
int downNode = myNodeIndexes.get(prevIndex);
// for correct topological order
- if (edgeRestrictions.hasRestriction(upNode))
- break;
+ if (edgeRestrictions.hasRestriction(upNode)) break;
// upNode is mergeCommit
List downNodes = getDownNodes(myPermanentGraph, upNode);
- if (downNodes.size() > 1 && downNodes.contains(downNode))
- continue;
+ if (downNodes.size() > 1 && downNodes.contains(downNode)) continue;
// division
- if (!downNodes.contains(downNode))
- break;
+ if (!downNodes.contains(downNode)) break;
long delta = Math.abs(timestampGetter.getTimestamp(upNode) - timestampGetter.getTimestamp(downNode));
// long time between commits
- if (delta > MAX_DELTA_TIME)
- break;
+ if (delta > MAX_DELTA_TIME) break;
// if block so long
- if (prevIndex < myNoInsertSize - MAX_BLOCK_SIZE && delta > SMALL_DELTA_TIME)
- break;
+ if (prevIndex < myNoInsertSize - MAX_BLOCK_SIZE && delta > SMALL_DELTA_TIME) break;
}
myPrepareForInsertPart = myNodeIndexes.subList(prevIndex, myNoInsertSize);
diff --git a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/facade/bek/BekBranchCreator.java b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/facade/bek/BekBranchCreator.java
index 8cbfd2961917..f8092d6b503f 100644
--- a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/facade/bek/BekBranchCreator.java
+++ b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/facade/bek/BekBranchCreator.java
@@ -30,17 +30,12 @@ import static com.intellij.vcs.log.graph.utils.LinearGraphUtils.getDownNodes;
import static com.intellij.vcs.log.graph.utils.LinearGraphUtils.getUpNodes;
class BekBranchCreator {
- @NotNull
- private final LinearGraph myPermanentGraph;
- @NotNull
- private final GraphLayoutImpl myGraphLayout;
- @NotNull
- private final Flags myDoneNodes;
+ @NotNull private final LinearGraph myPermanentGraph;
+ @NotNull private final GraphLayoutImpl myGraphLayout;
+ @NotNull private final Flags myDoneNodes;
- @NotNull
- private final DfsUtil myDfsUtil = new DfsUtil();
- @NotNull
- private final BekEdgeRestrictions myEdgeRestrictions = new BekEdgeRestrictions();
+ @NotNull private final DfsUtil myDfsUtil = new DfsUtil();
+ @NotNull private final BekEdgeRestrictions myEdgeRestrictions = new BekEdgeRestrictions();
public BekBranchCreator(@NotNull LinearGraph permanentGraph, @NotNull GraphLayoutImpl graphLayout) {
myPermanentGraph = permanentGraph;
@@ -77,8 +72,7 @@ class BekBranchCreator {
int downNode = downNodes.get(i);
if (myDoneNodes.get(downNode)) {
- if (myGraphLayout.getLayoutIndex(downNode) < startLayout)
- myEdgeRestrictions.addRestriction(currentNode, downNode);
+ if (myGraphLayout.getLayoutIndex(downNode) < startLayout) myEdgeRestrictions.addRestriction(currentNode, downNode);
}
else if (currentLayout <= myGraphLayout.getLayoutIndex(downNode)) {
diff --git a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/facade/bek/BekBranchMerger.java b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/facade/bek/BekBranchMerger.java
index 552f5d33e852..dc248e4f0e4f 100644
--- a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/facade/bek/BekBranchMerger.java
+++ b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/facade/bek/BekBranchMerger.java
@@ -22,15 +22,11 @@ import org.jetbrains.annotations.NotNull;
import java.util.List;
class BekBranchMerger {
- @NotNull
- private final List myBekBranches;
- @NotNull
- private final BekEdgeRestrictions myEdgeRestrictions;
- @NotNull
- private final TimestampGetter myTimestampGetter;
+ @NotNull private final List myBekBranches;
+ @NotNull private final BekEdgeRestrictions myEdgeRestrictions;
+ @NotNull private final TimestampGetter myTimestampGetter;
- @NotNull
- private final List myInverseResultList = ContainerUtil.newArrayList();
+ @NotNull private final List myInverseResultList = ContainerUtil.newArrayList();
public BekBranchMerger(@NotNull List bekBranches,
@NotNull BekEdgeRestrictions edgeRestrictions,
@@ -44,7 +40,7 @@ class BekBranchMerger {
private boolean prepareLastPartsForBranches() {
boolean hasUndoneBranches = false;
for (BekBranch bekBranch : myBekBranches) {
- if (!bekBranch.isDone()){
+ if (!bekBranch.isDone()) {
hasUndoneBranches = true;
if (bekBranch.getPrepareForInsertPart() == null) {
bekBranch.updatePrepareForInsertPart(myTimestampGetter, myEdgeRestrictions);
@@ -56,8 +52,7 @@ class BekBranchMerger {
private long getBranchLastPartTimestamp(BekBranch bekBranch) {
List prepareForInsertPart = bekBranch.getPrepareForInsertPart();
- if (prepareForInsertPart == null)
- return Long.MAX_VALUE;
+ if (prepareForInsertPart == null) return Long.MAX_VALUE;
assert !prepareForInsertPart.isEmpty();
int nodeIndex = prepareForInsertPart.get(0);
@@ -74,8 +69,9 @@ class BekBranchMerger {
List prepareForInsertPart = selectBranch.getPrepareForInsertPart();
assert prepareForInsertPart != null;
- for (int insertedNode: prepareForInsertPart)
+ for (int insertedNode : prepareForInsertPart) {
myEdgeRestrictions.removeRestriction(insertedNode);
+ }
myInverseResultList.addAll(ContainerUtil.reverse(prepareForInsertPart));
selectBranch.doneInsertPreparedPart();
diff --git a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/facade/bek/BekChecker.java b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/facade/bek/BekChecker.java
index 609b7c52219d..b1dcc6a9bdd9 100644
--- a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/facade/bek/BekChecker.java
+++ b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/facade/bek/BekChecker.java
@@ -26,15 +26,13 @@ public class BekChecker {
private final static Logger LOG = Logger.getInstance("#com.intellij.vcs.log.graph.impl.facade.bek.BekChecker");
public static boolean checkLinearGraph(@NotNull LinearGraph linearGraph) {
- for (int i = 0; i < linearGraph.nodesCount(); i++) {
+ for (int i = 0; i < linearGraph.nodesCount(); i++) {
for (int downNode : getDownNodes(linearGraph, i)) {
- if (downNode <= i)
- LOG.error("Illegal node: " + i + ", with downNode: " + downNode);
+ if (downNode <= i) LOG.error("Illegal node: " + i + ", with downNode: " + downNode);
}
for (int upNode : getUpNodes(linearGraph, i)) {
- if (upNode >= i)
- LOG.error("Illegal node: " + i + ", with upNode: " + upNode);
+ if (upNode >= i) LOG.error("Illegal node: " + i + ", with upNode: " + upNode);
}
}
return true;
diff --git a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/facade/bek/BekEdgeRestrictions.java b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/facade/bek/BekEdgeRestrictions.java
index e68fe8d143df..ad1e1b85f8e8 100644
--- a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/facade/bek/BekEdgeRestrictions.java
+++ b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/facade/bek/BekEdgeRestrictions.java
@@ -19,11 +19,9 @@ import com.intellij.util.containers.MultiMap;
import org.jetbrains.annotations.NotNull;
class BekEdgeRestrictions {
- @NotNull
- private final MultiMap myUpToEdge = new MultiMap();
+ @NotNull private final MultiMap myUpToEdge = new MultiMap();
- @NotNull
- private final MultiMap myDownToEdge = new MultiMap();
+ @NotNull private final MultiMap myDownToEdge = new MultiMap();
void addRestriction(int upNode, int downNode) {
myUpToEdge.putValue(upNode, downNode);
@@ -31,7 +29,7 @@ class BekEdgeRestrictions {
}
void removeRestriction(int downNode) {
- for (int upNode: myDownToEdge.get(downNode)) {
+ for (int upNode : myDownToEdge.get(downNode)) {
myUpToEdge.remove(upNode, downNode);
}
}
diff --git a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/facade/bek/BekIntMap.java b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/facade/bek/BekIntMap.java
index 78d4b359df6b..8bc35e2fa6fa 100644
--- a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/facade/bek/BekIntMap.java
+++ b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/facade/bek/BekIntMap.java
@@ -20,5 +20,6 @@ public interface BekIntMap {
// usualIndex == id
int getBekIndex(int usualIndex);
+
int getUsualIndex(int bekIndex);
}
diff --git a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/permanent/DuplicateParentFixer.java b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/permanent/DuplicateParentFixer.java
index ce3a404adf2b..4e57a06bc2b8 100644
--- a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/permanent/DuplicateParentFixer.java
+++ b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/permanent/DuplicateParentFixer.java
@@ -40,11 +40,9 @@ public class DuplicateParentFixer {
}
private static class DelegateGraphCommit implements GraphCommit {
- @NotNull
- private final GraphCommit myDelegate;
+ @NotNull private final GraphCommit myDelegate;
- @NotNull
- private final List myParents;
+ @NotNull private final List myParents;
private DelegateGraphCommit(@NotNull GraphCommit delegate, @NotNull List parents) {
myDelegate = delegate;
@@ -72,21 +70,20 @@ public class DuplicateParentFixer {
@NotNull
private static GraphCommit fixParentsDuplicate(@NotNull GraphCommit commit) {
List parents = commit.getParents();
- if (parents.size() <= 1)
- return commit;
+ if (parents.size() <= 1) return commit;
if (parents.size() == 2) {
CommitId commitId0 = parents.get(0);
if (!commitId0.equals(parents.get(1))) {
return commit;
- } else {
+ }
+ else {
return new DelegateGraphCommit(commit, Collections.singletonList(commitId0));
}
}
Set allParents = new HashSet(parents);
- if (parents.size() == allParents.size())
- return commit;
+ if (parents.size() == allParents.size()) return commit;
List correctParents = ContainerUtil.newArrayList();
for (CommitId commitId : parents) {
diff --git a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/permanent/GraphLayoutBuilder.java b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/permanent/GraphLayoutBuilder.java
index fabe530db759..30016931f4c7 100644
--- a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/permanent/GraphLayoutBuilder.java
+++ b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/permanent/GraphLayoutBuilder.java
@@ -52,18 +52,13 @@ public class GraphLayoutBuilder {
return builder.build();
}
- @NotNull
- private final LinearGraph myGraph;
- @NotNull
- private final int[] myLayoutIndex;
+ @NotNull private final LinearGraph myGraph;
+ @NotNull private final int[] myLayoutIndex;
- @NotNull
- private final List myHeadNodeIndex;
- @NotNull
- private final int[] myStartLayoutIndexForHead;
+ @NotNull private final List myHeadNodeIndex;
+ @NotNull private final int[] myStartLayoutIndexForHead;
- @NotNull
- private final DfsUtil myDfsUtil;
+ @NotNull private final DfsUtil myDfsUtil;
private int currentLayoutIndex = 1;
@@ -82,8 +77,7 @@ public class GraphLayoutBuilder {
@Override
public int fun(int currentNode) {
boolean firstVisit = myLayoutIndex[currentNode] == 0;
- if (firstVisit)
- myLayoutIndex[currentNode] = currentLayoutIndex;
+ if (firstVisit) myLayoutIndex[currentNode] = currentLayoutIndex;
int childWithoutLayoutIndex = -1;
for (int childNodeIndex : getDownNodes(myGraph, currentNode)) {
@@ -94,11 +88,11 @@ public class GraphLayoutBuilder {
}
if (childWithoutLayoutIndex == -1) {
- if (firstVisit)
- currentLayoutIndex++;
+ if (firstVisit) currentLayoutIndex++;
return DfsUtil.NextNode.NODE_NOT_FOUND;
- } else {
+ }
+ else {
return childWithoutLayoutIndex;
}
}
@@ -107,7 +101,7 @@ public class GraphLayoutBuilder {
@NotNull
private GraphLayoutImpl build() {
- for(int i = 0; i < myHeadNodeIndex.size(); i++) {
+ for (int i = 0; i < myHeadNodeIndex.size(); i++) {
int headNodeIndex = myHeadNodeIndex.get(i);
myStartLayoutIndexForHead[i] = currentLayoutIndex;
diff --git a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/permanent/GraphLayoutImpl.java b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/permanent/GraphLayoutImpl.java
index b658a7a42c56..bfc1fbfae8cc 100644
--- a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/permanent/GraphLayoutImpl.java
+++ b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/permanent/GraphLayoutImpl.java
@@ -23,13 +23,10 @@ import org.jetbrains.annotations.NotNull;
import java.util.List;
public class GraphLayoutImpl implements GraphLayout {
- @NotNull
- private final IntList myLayoutIndex;
+ @NotNull private final IntList myLayoutIndex;
- @NotNull
- private final List myHeadNodeIndex;
- @NotNull
- private final int[] myStartLayoutIndexForHead;
+ @NotNull private final List myHeadNodeIndex;
+ @NotNull private final int[] myStartLayoutIndexForHead;
GraphLayoutImpl(@NotNull int[] layoutIndex, @NotNull List headNodeIndex, @NotNull int[] startLayoutIndexForHead) {
myLayoutIndex = CompressedIntList.newInstance(layoutIndex);
@@ -61,10 +58,12 @@ public class GraphLayoutImpl implements GraphLayout {
int b = myStartLayoutIndexForHead.length - 1;
while (b > a) {
int middle = (a + b + 1) / 2;
- if (myStartLayoutIndexForHead[middle] <= layoutIndex)
+ if (myStartLayoutIndexForHead[middle] <= layoutIndex) {
a = middle;
- else
+ }
+ else {
b = middle - 1;
+ }
}
return a;
}
diff --git a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/permanent/PermanentCommitsInfoIml.java b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/permanent/PermanentCommitsInfoIml.java
index aa111be5b711..e6d0418165dc 100644
--- a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/permanent/PermanentCommitsInfoIml.java
+++ b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/permanent/PermanentCommitsInfoIml.java
@@ -18,12 +18,12 @@ package com.intellij.vcs.log.graph.impl.permanent;
import com.intellij.util.Function;
import com.intellij.util.containers.ContainerUtil;
+import com.intellij.vcs.log.graph.GraphCommit;
import com.intellij.vcs.log.graph.api.permanent.PermanentCommitsInfo;
import com.intellij.vcs.log.graph.utils.IntList;
import com.intellij.vcs.log.graph.utils.TimestampGetter;
import com.intellij.vcs.log.graph.utils.impl.CompressedIntList;
import com.intellij.vcs.log.graph.utils.impl.IntTimestampGetter;
-import com.intellij.vcs.log.graph.GraphCommit;
import org.jetbrains.annotations.NotNull;
import java.util.*;
@@ -50,7 +50,8 @@ public class PermanentCommitsInfoIml implements PermanentCommitsInfo commitIdIndex;
if (isIntegerCase) {
commitIdIndex = (List)createCompressedIntList((List extends GraphCommit>)graphCommits);
- } else {
+ }
+ else {
commitIdIndex = ContainerUtil.map(graphCommits, new Function, CommitId>() {
@Override
public CommitId fun(GraphCommit graphCommit) {
@@ -88,14 +89,11 @@ public class PermanentCommitsInfoIml implements PermanentCommitsInfo myCommitIdIndexes;
+ @NotNull private final List myCommitIdIndexes;
- @NotNull
- private final Map myNotLoadCommits;
+ @NotNull private final Map myNotLoadCommits;
public PermanentCommitsInfoIml(@NotNull TimestampGetter timestampGetter,
@NotNull List commitIdIndex,
@@ -108,15 +106,13 @@ public class PermanentCommitsInfoIml implements PermanentCommitsInfo implements PermanentCommitsInfo entry : myNotLoadCommits.entrySet()) {
- if (entry.getValue().equals(commitId))
- return entry.getKey();
+ if (entry.getValue().equals(commitId)) return entry.getKey();
}
return -1;
}
@@ -173,8 +167,7 @@ public class PermanentCommitsInfoIml implements PermanentCommitsInfo entry : myNotLoadCommits.entrySet()) {
- if (commitIds.contains(entry.getValue()))
- result.add(entry.getKey());
+ if (commitIds.contains(entry.getValue())) result.add(entry.getKey());
}
return result;
}
diff --git a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/permanent/PermanentLinearGraphBuilder.java b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/permanent/PermanentLinearGraphBuilder.java
index 91ceaa50e5b4..579b8d1fa63d 100644
--- a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/permanent/PermanentLinearGraphBuilder.java
+++ b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/permanent/PermanentLinearGraphBuilder.java
@@ -46,7 +46,8 @@ public class PermanentLinearGraphBuilder {
List parents = commit.getParents();
if (parents.size() == 1 && parents.get(0).equals(nextCommitHashIndex)) {
simpleNodes.set(nodeIndex, true);
- } else {
+ }
+ else {
longEdgesCount += parents.size();
}
}
@@ -56,8 +57,7 @@ public class PermanentLinearGraphBuilder {
@Nullable
private static CommitId nextCommitHashIndex(List extends GraphCommit> commits, int nodeIndex) {
- if (nodeIndex < commits.size() - 1)
- return commits.get(nodeIndex + 1).getId();
+ if (nodeIndex < commits.size() - 1) return commits.get(nodeIndex + 1).getId();
return null;
}
@@ -107,7 +107,8 @@ public class PermanentLinearGraphBuilder {
if (myLongEdges[edgeIndex] == -1) {
myLongEdges[edgeIndex] = downNodeIndex;
return;
- } else {
+ }
+ else {
throw new IllegalStateException("Edge was set early!. Up node: " + upNodeIndex + ", down node: " + downNodeIndex);
}
}
@@ -119,8 +120,7 @@ public class PermanentLinearGraphBuilder {
GraphCommit commit = myCommits.get(nodeIndex);
List upNodes = upAdjacentNodes.remove(commit.getId());
- if (upNodes == null)
- upNodes = Collections.emptyList();
+ if (upNodes == null) upNodes = Collections.emptyList();
int edgeIndex = myNodeToEdgeIndex[nodeIndex];
for (Integer upNodeIndex : upNodes) {
diff --git a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/permanent/PermanentLinearGraphImpl.java b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/permanent/PermanentLinearGraphImpl.java
index f7919027758e..e98af978c6a6 100644
--- a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/permanent/PermanentLinearGraphImpl.java
+++ b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/permanent/PermanentLinearGraphImpl.java
@@ -95,9 +95,11 @@ public class PermanentLinearGraphImpl implements LinearGraph {
@Override
public Integer getNodeIndex(int nodeId) {
- if (nodeId >= 0 && nodeId < nodesCount())
+ if (nodeId >= 0 && nodeId < nodesCount()) {
return nodeId;
- else
+ }
+ else {
return null;
+ }
}
}
diff --git a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/print/AbstractPrintElementGenerator.java b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/print/AbstractPrintElementGenerator.java
index 0d7fe66dfd62..3906f8831766 100644
--- a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/print/AbstractPrintElementGenerator.java
+++ b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/print/AbstractPrintElementGenerator.java
@@ -33,10 +33,8 @@ import java.util.Collection;
public abstract class AbstractPrintElementGenerator implements PrintElementGenerator {
- @NotNull
- protected final LinearGraph myLinearGraph;
- @NotNull
- protected final PrintElementManager myPrintElementManager;
+ @NotNull protected final LinearGraph myLinearGraph;
+ @NotNull protected final PrintElementManager myPrintElementManager;
protected AbstractPrintElementGenerator(@NotNull LinearGraph linearGraph, @NotNull PrintElementManager printElementManager) {
myLinearGraph = linearGraph;
@@ -75,7 +73,8 @@ public abstract class AbstractPrintElementGenerator implements PrintElementGener
if (type == EdgePrintElement.Type.DOWN) {
positionInCurrentRow = shortEdge.myUpPosition;
positionInOtherRow = shortEdge.myDownPosition;
- } else {
+ }
+ else {
positionInCurrentRow = shortEdge.myDownPosition;
positionInOtherRow = shortEdge.myUpPosition;
}
@@ -91,8 +90,7 @@ public abstract class AbstractPrintElementGenerator implements PrintElementGener
int rowIndex = printElement.getRowIndex();
for (PrintElementWithGraphElement printElementWithGE : getPrintElements(rowIndex)) {
- if (printElementWithGE.equals(printElement))
- return printElementWithGE;
+ if (printElementWithGE.equals(printElement)) return printElementWithGE;
}
throw new IllegalStateException("Not found graphElement for this printElement: " + printElement);
}
@@ -105,8 +103,7 @@ public abstract class AbstractPrintElementGenerator implements PrintElementGener
protected abstract Collection getSimpleRowElements(int rowIndex);
protected static class ShortEdge {
- @NotNull
- public final GraphEdge myEdge;
+ @NotNull public final GraphEdge myEdge;
public final int myUpPosition;
public final int myDownPosition;
@@ -118,10 +115,8 @@ public abstract class AbstractPrintElementGenerator implements PrintElementGener
}
protected static class SimpleRowElement {
- @NotNull
- public final GraphElement myElement;
- @NotNull
- public final SimplePrintElement.Type myType;
+ @NotNull public final GraphElement myElement;
+ @NotNull public final SimplePrintElement.Type myType;
public final int myPosition;
public SimpleRowElement(@NotNull GraphElement element, @NotNull SimplePrintElement.Type type, int position) {
diff --git a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/print/ColorGetterByLayoutIndex.java b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/print/ColorGetterByLayoutIndex.java
index e33bc99ba266..61f06de8de63 100644
--- a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/print/ColorGetterByLayoutIndex.java
+++ b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/print/ColorGetterByLayoutIndex.java
@@ -26,10 +26,8 @@ import com.intellij.vcs.log.graph.utils.LinearGraphUtils;
import org.jetbrains.annotations.NotNull;
public class ColorGetterByLayoutIndex {
- @NotNull
- private final LinearGraph myLinearGraph;
- @NotNull
- private final PermanentGraphInfo myPermanentGraphInfo;
+ @NotNull private final LinearGraph myLinearGraph;
+ @NotNull private final PermanentGraphInfo myPermanentGraphInfo;
public ColorGetterByLayoutIndex(@NotNull LinearGraph linearGraph, @NotNull PermanentGraphInfo permanentGraphInfo) {
myLinearGraph = linearGraph;
@@ -41,13 +39,15 @@ public class ColorGetterByLayoutIndex {
if (element instanceof GraphNode) {
upNodeIndex = ((GraphNode)element).getNodeIndex();
downNodeIndex = upNodeIndex;
- } else {
+ }
+ else {
GraphEdge edge = (GraphEdge)element;
Pair normalEdge = LinearGraphUtils.asNormalEdge(edge);
if (normalEdge != null) {
upNodeIndex = normalEdge.first;
downNodeIndex = normalEdge.second;
- } else {
+ }
+ else {
upNodeIndex = LinearGraphUtils.getNotNullNodeIndex(edge);
downNodeIndex = upNodeIndex;
}
@@ -62,17 +62,18 @@ public class ColorGetterByLayoutIndex {
return myColorManager.getColorOfFragment(headCommitId, Math.max(upLayoutIndex, downLayoutIndex));
}
- if (upLayoutIndex == myPermanentGraphInfo.getPermanentGraphLayout().getLayoutIndex(getHeadNodeId(upNodeIndex)))
+ if (upLayoutIndex == myPermanentGraphInfo.getPermanentGraphLayout().getLayoutIndex(getHeadNodeId(upNodeIndex))) {
return myColorManager.getColorOfBranch(headCommitId);
- else
+ }
+ else {
return myColorManager.getColorOfFragment(headCommitId, upLayoutIndex);
+ }
}
private int getHeadNodeId(int upNodeIndex) {
int nodeId = getNodeId(upNodeIndex);
- if (nodeId < 0)
- return 0;
+ if (nodeId < 0) return 0;
return myPermanentGraphInfo.getPermanentGraphLayout().getOneOfHeadNodeIndex(nodeId);
}
@@ -82,8 +83,7 @@ public class ColorGetterByLayoutIndex {
private int getLayoutIndex(int upNodeIndex) {
int nodeId = getNodeId(upNodeIndex);
- if (nodeId < 0)
- return nodeId;
+ if (nodeId < 0) return nodeId;
return myPermanentGraphInfo.getPermanentGraphLayout().getLayoutIndex(nodeId);
}
diff --git a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/print/EdgesInRowGenerator.java b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/print/EdgesInRowGenerator.java
index d809048b5424..5c7d8ce677d4 100644
--- a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/print/EdgesInRowGenerator.java
+++ b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/print/EdgesInRowGenerator.java
@@ -31,11 +31,9 @@ public class EdgesInRowGenerator {
private final int WALK_SIZE;
- @NotNull
- private final LinearGraph myGraph;
+ @NotNull private final LinearGraph myGraph;
- @NotNull
- private final SLRUMap cacheNU = new SLRUMap(CACHE_SIZE, CACHE_SIZE * 2);
+ @NotNull private final SLRUMap cacheNU = new SLRUMap(CACHE_SIZE, CACHE_SIZE * 2);
private final SLRUMap cacheND = new SLRUMap(CACHE_SIZE, CACHE_SIZE * 2);
public EdgesInRowGenerator(@NotNull LinearGraph graph) {
@@ -153,8 +151,7 @@ public class EdgesInRowGenerator {
private static class GraphEdges {
// this must be mutably set
- @NotNull
- private final Set myEdges;
+ @NotNull private final Set myEdges;
private final int myRow;
private GraphEdges(int row) {
diff --git a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/print/GraphElementComparatorByLayoutIndex.java b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/print/GraphElementComparatorByLayoutIndex.java
index ad3669ea6a3a..77ccc6b4f3ba 100644
--- a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/print/GraphElementComparatorByLayoutIndex.java
+++ b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/print/GraphElementComparatorByLayoutIndex.java
@@ -16,7 +16,6 @@
package com.intellij.vcs.log.graph.impl.print;
import com.intellij.openapi.util.Pair;
-import com.intellij.util.Function;
import com.intellij.util.NotNullFunction;
import com.intellij.vcs.log.graph.api.elements.GraphEdge;
import com.intellij.vcs.log.graph.api.elements.GraphElement;
@@ -29,8 +28,7 @@ import static com.intellij.vcs.log.graph.utils.LinearGraphUtils.asNormalEdge;
import static com.intellij.vcs.log.graph.utils.LinearGraphUtils.getNotNullNodeIndex;
public class GraphElementComparatorByLayoutIndex implements Comparator {
- @NotNull
- private final NotNullFunction myLayoutIndexGetter;
+ @NotNull private final NotNullFunction myLayoutIndexGetter;
public GraphElementComparatorByLayoutIndex(@NotNull NotNullFunction layoutIndexGetter) {
myLayoutIndexGetter = layoutIndexGetter;
@@ -43,29 +41,29 @@ public class GraphElementComparatorByLayoutIndex implements Comparator normalEdge1 = asNormalEdge(edge1);
Pair normalEdge2 = asNormalEdge(edge2);
- if (normalEdge1 == null)
- return - compare2(edge2, new GraphNode(getNotNullNodeIndex(edge1)));
- if (normalEdge2 == null)
- return compare2(edge1, new GraphNode(getNotNullNodeIndex(edge2)));
+ if (normalEdge1 == null) return -compare2(edge2, new GraphNode(getNotNullNodeIndex(edge1)));
+ if (normalEdge2 == null) return compare2(edge1, new GraphNode(getNotNullNodeIndex(edge2)));
if (normalEdge1.first.equals(normalEdge2.first)) {
- if (getLayoutIndex(normalEdge1.second) != getLayoutIndex(normalEdge2.second))
+ if (getLayoutIndex(normalEdge1.second) != getLayoutIndex(normalEdge2.second)) {
return getLayoutIndex(normalEdge1.second) - getLayoutIndex(normalEdge2.second);
- else
+ }
+ else {
return normalEdge1.second - (int)normalEdge2.second;
+ }
}
- if (normalEdge1.first < normalEdge2.first)
+ if (normalEdge1.first < normalEdge2.first) {
return compare2(edge1, new GraphNode(normalEdge2.first));
- else
- return - compare2(edge2, new GraphNode(normalEdge1.first));
+ }
+ else {
+ return -compare2(edge2, new GraphNode(normalEdge1.first));
+ }
}
- if (o1 instanceof GraphEdge && o2 instanceof GraphNode)
- return compare2((GraphEdge) o1, (GraphNode) o2);
+ if (o1 instanceof GraphEdge && o2 instanceof GraphNode) return compare2((GraphEdge)o1, (GraphNode)o2);
- if (o1 instanceof GraphNode && o2 instanceof GraphEdge)
- return - compare2((GraphEdge) o2, (GraphNode) o1);
+ if (o1 instanceof GraphNode && o2 instanceof GraphEdge) return -compare2((GraphEdge)o2, (GraphNode)o1);
assert false; // both GraphNode
return 0;
@@ -81,10 +79,12 @@ public class GraphElementComparatorByLayoutIndex implements Comparator> cache = new SLRUMap>(CACHE_SIZE, CACHE_SIZE * 2);
- @NotNull
- private final EdgesInRowGenerator myEdgesInRowGenerator;
- @NotNull
- private final Comparator myGraphElementComparator;
+ @NotNull private final SLRUMap> cache = new SLRUMap>(CACHE_SIZE, CACHE_SIZE * 2);
+ @NotNull private final EdgesInRowGenerator myEdgesInRowGenerator;
+ @NotNull private final Comparator myGraphElementComparator;
private final int myLongSize;
private final int myShowingPartSize;
private final int myAddNearArrowSize;
- public PrintElementGeneratorImpl(@NotNull LinearGraph graph,
- @NotNull PrintElementManager printElementManager,
- boolean showLongEdges) {
+ public PrintElementGeneratorImpl(@NotNull LinearGraph graph, @NotNull PrintElementManager printElementManager, boolean showLongEdges) {
super(graph, printElementManager);
myEdgesInRowGenerator = new EdgesInRowGenerator(graph);
myGraphElementComparator = printElementManager.getGraphElementComparator();
if (showLongEdges) {
myLongSize = VERY_LONG_EDGE_SIZE;
myShowingPartSize = VERY_LONG_EDGE_PART_SIZE;
- if (SHOW_ARROW_WHEN_SHOW_LONG_EDGES)
+ if (SHOW_ARROW_WHEN_SHOW_LONG_EDGES) {
myAddNearArrowSize = LONG_EDGE_SIZE;
- else
+ }
+ else {
myAddNearArrowSize = Integer.MAX_VALUE;
- } else {
+ }
+ }
+ else {
myLongSize = LONG_EDGE_SIZE;
myShowingPartSize = LONG_EDGE_PART_SIZE;
myAddNearArrowSize = Integer.MAX_VALUE;
@@ -91,7 +89,7 @@ public class PrintElementGeneratorImpl extends AbstractPrintElementGenerator {
myAddNearArrowSize = addNearArrowSize;
}
- @NotNull
+ @NotNull
@Override
protected List getDownShortEdges(int rowIndex) {
NullableFunction endPosition = createEndPositionFunction(rowIndex);
@@ -112,7 +110,7 @@ public class PrintElementGeneratorImpl extends AbstractPrintElementGenerator {
}
if (element instanceof GraphEdge) {
- GraphEdge edge = (GraphEdge) element;
+ GraphEdge edge = (GraphEdge)element;
Integer endPos = endPosition.fun(edge);
if (endPos != null) result.add(new ShortEdge(edge, startPosition, endPos));
}
@@ -126,8 +124,9 @@ public class PrintElementGeneratorImpl extends AbstractPrintElementGenerator {
List visibleElementsInNextRow = getSortedVisibleElementsInRow(visibleRowIndex + 1);
final Map toPosition = new HashMap();
- for (int position = 0; position < visibleElementsInNextRow.size(); position++)
+ for (int position = 0; position < visibleElementsInNextRow.size(); position++) {
toPosition.put(visibleElementsInNextRow.get(position), position);
+ }
return new NullableFunction() {
@Override
@@ -136,8 +135,7 @@ public class PrintElementGeneratorImpl extends AbstractPrintElementGenerator {
Integer position = toPosition.get(edge);
if (position == null) {
Integer downNodeIndex = edge.getDownNodeIndex();
- if (downNodeIndex != null)
- position = toPosition.get(myLinearGraph.getGraphNode(downNodeIndex));
+ if (downNodeIndex != null) position = toPosition.get(myLinearGraph.getGraphNode(downNodeIndex));
}
return position;
}
@@ -164,22 +162,24 @@ public class PrintElementGeneratorImpl extends AbstractPrintElementGenerator {
int upOffset = visibleRowIndex - normalEdge.first;
int downOffset = normalEdge.second - visibleRowIndex;
- if (edgeSize >= myLongSize)
- addArrowIfNeeded(result, edge, position, upOffset, downOffset, myShowingPartSize);
+ if (edgeSize >= myLongSize) addArrowIfNeeded(result, edge, position, upOffset, downOffset, myShowingPartSize);
- if (edgeSize >= myAddNearArrowSize)
- addArrowIfNeeded(result, edge, position, upOffset, downOffset, 1);
+ if (edgeSize >= myAddNearArrowSize) addArrowIfNeeded(result, edge, position, upOffset, downOffset, 1);
- } else { // special edges
+ }
+ else { // special edges
switch (edge.getType()) {
case DOTTED_ARROW_DOWN:
case NOT_LOAD_COMMIT:
- if (intEqual(edge.getUpNodeIndex(), visibleRowIndex - 1))
+ if (intEqual(edge.getUpNodeIndex(), visibleRowIndex - 1)) {
result.add(new SimpleRowElement(edge, SimplePrintElement.Type.DOWN_ARROW, position));
+ }
break;
case DOTTED_ARROW_UP:
if (intEqual(edge.getDownNodeIndex(), visibleRowIndex + 1)) // todo case 0-row arrow
+ {
result.add(new SimpleRowElement(edge, SimplePrintElement.Type.UP_ARROW, position));
+ }
break;
default:
// todo log some error (nothing here)
@@ -196,20 +196,21 @@ public class PrintElementGeneratorImpl extends AbstractPrintElementGenerator {
int upOffset,
int downOffset,
int showingPartSize) {
- if (upOffset == showingPartSize)
- result.add(new SimpleRowElement(edge, SimplePrintElement.Type.DOWN_ARROW, position));
+ if (upOffset == showingPartSize) result.add(new SimpleRowElement(edge, SimplePrintElement.Type.DOWN_ARROW, position));
- if (downOffset == showingPartSize)
- result.add(new SimpleRowElement(edge, SimplePrintElement.Type.UP_ARROW, position));
+ if (downOffset == showingPartSize) result.add(new SimpleRowElement(edge, SimplePrintElement.Type.UP_ARROW, position));
}
private boolean edgeIsVisibleInRow(@NotNull GraphEdge edge, int visibleRowIndex) {
Pair normalEdge = LinearGraphUtils.asNormalEdge(edge);
if (normalEdge == null) // e.d. edge is special. See addSpecialEdges
+ {
return false;
+ }
if (normalEdge.second - normalEdge.first < myLongSize) {
return true;
- } else {
+ }
+ else {
return visibleRowIndex - normalEdge.first <= myShowingPartSize || normalEdge.second - visibleRowIndex <= myShowingPartSize;
}
}
@@ -240,8 +241,7 @@ public class PrintElementGeneratorImpl extends AbstractPrintElementGenerator {
result.add(myLinearGraph.getGraphNode(rowIndex));
for (GraphEdge edge : myEdgesInRowGenerator.getEdgesInRow(rowIndex)) {
- if (edgeIsVisibleInRow(edge, rowIndex))
- result.add(edge);
+ if (edgeIsVisibleInRow(edge, rowIndex)) result.add(edge);
}
addSpecialEdges(result, rowIndex);
diff --git a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/print/elements/EdgePrintElementImpl.java b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/print/elements/EdgePrintElementImpl.java
index a12d4767a9f6..d8e95beec9cb 100644
--- a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/print/elements/EdgePrintElementImpl.java
+++ b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/print/elements/EdgePrintElementImpl.java
@@ -38,10 +38,8 @@ public class EdgePrintElementImpl extends PrintElementWithGraphElement implement
}
}
- @NotNull
- private final Type myType;
- @NotNull
- private final LineStyle myLineStyle;
+ @NotNull private final Type myType;
+ @NotNull private final LineStyle myLineStyle;
private final int myPositionInOtherRow;
public EdgePrintElementImpl(int rowIndex,
diff --git a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/print/elements/PrintElementWithGraphElement.java b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/print/elements/PrintElementWithGraphElement.java
index cde373254ee5..b1f93f358360 100644
--- a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/print/elements/PrintElementWithGraphElement.java
+++ b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/print/elements/PrintElementWithGraphElement.java
@@ -20,17 +20,14 @@ import com.intellij.vcs.log.graph.PrintElement;
import com.intellij.vcs.log.graph.api.elements.GraphElement;
import com.intellij.vcs.log.graph.api.printer.PrintElementManager;
import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
public abstract class PrintElementWithGraphElement implements PrintElement {
protected final int myRowIndex;
protected final int myPositionInCurrentRow;
- @NotNull
- protected final GraphElement myGraphElement;
- @NotNull
- protected final PrintElementManager myPrintElementManager;
+ @NotNull protected final GraphElement myGraphElement;
+ @NotNull protected final PrintElementManager myPrintElementManager;
protected PrintElementWithGraphElement(int rowIndex,
int positionInCurrentRow,
@@ -67,8 +64,10 @@ public abstract class PrintElementWithGraphElement implements PrintElement {
return myPrintElementManager.isSelected(this);
}
- public static PrintElementWithGraphElement converted(@NotNull PrintElementWithGraphElement element, @NotNull GraphElement convertedGraphElement) {
- return new PrintElementWithGraphElement(element.getRowIndex(), element.getPositionInCurrentRow(), convertedGraphElement, element.myPrintElementManager) {
+ public static PrintElementWithGraphElement converted(@NotNull PrintElementWithGraphElement element,
+ @NotNull GraphElement convertedGraphElement) {
+ return new PrintElementWithGraphElement(element.getRowIndex(), element.getPositionInCurrentRow(), convertedGraphElement,
+ element.myPrintElementManager) {
};
}
}
diff --git a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/print/elements/SimplePrintElementImpl.java b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/print/elements/SimplePrintElementImpl.java
index 8c84d8202f44..3dd25d75bc74 100644
--- a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/print/elements/SimplePrintElementImpl.java
+++ b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/print/elements/SimplePrintElementImpl.java
@@ -23,8 +23,7 @@ import org.jetbrains.annotations.NotNull;
public class SimplePrintElementImpl extends PrintElementWithGraphElement implements SimplePrintElement {
- @NotNull
- private final Type myType;
+ @NotNull private final Type myType;
public SimplePrintElementImpl(int rowIndex,
int positionInCurrentRow,
diff --git a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/visible/LinearFragmentGenerator.java b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/visible/LinearFragmentGenerator.java
index 4530011e0a22..d82bfb8ee74b 100644
--- a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/visible/LinearFragmentGenerator.java
+++ b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/visible/LinearFragmentGenerator.java
@@ -37,11 +37,9 @@ public class LinearFragmentGenerator {
private static final int SHORT_FRAGMENT_MAX_SIZE = 10;
private static final int MAX_SEARCH_SIZE = 10;
- @NotNull
- private final LiteLinearGraph myLinearGraph;
+ @NotNull private final LiteLinearGraph myLinearGraph;
- @NotNull
- private final Set myPinnedNodes;
+ @NotNull private final Set myPinnedNodes;
private final Function> upNodesFun = new Function>() {
@Override
@@ -69,7 +67,8 @@ public class LinearFragmentGenerator {
if (element instanceof GraphNode) {
upNodeIndex = ((GraphNode)element).getNodeIndex();
downNodeIndex = upNodeIndex;
- } else {
+ }
+ else {
Pair graphEdge = LinearGraphUtils.asNormalEdge(((GraphEdge)element));
if (graphEdge == null) return null;
@@ -79,8 +78,7 @@ public class LinearFragmentGenerator {
for (int i = 0; i < MAX_SEARCH_SIZE; i++) {
GraphFragment graphFragment = getDownFragment(upNodeIndex);
- if (graphFragment != null && graphFragment.downNodeIndex >= downNodeIndex)
- return graphFragment;
+ if (graphFragment != null && graphFragment.downNodeIndex >= downNodeIndex) return graphFragment;
List upNodes = myLinearGraph.getNodes(upNodeIndex, UP);
if (upNodes.size() != 1) {
@@ -122,31 +120,28 @@ public class LinearFragmentGenerator {
@Nullable
private GraphFragment getLongFragment(@Nullable GraphFragment startFragment, int bound) {
- if (startFragment == null)
- return null;
+ if (startFragment == null) return null;
GraphFragment shortFragment;
int maxDown = startFragment.downNodeIndex;
while ((shortFragment = getDownFragment(maxDown)) != null && !myPinnedNodes.contains(maxDown)) {
maxDown = shortFragment.downNodeIndex;
- if (maxDown - startFragment.downNodeIndex > bound)
- break;
+ if (maxDown - startFragment.downNodeIndex > bound) break;
}
int maxUp = startFragment.upNodeIndex;
while ((shortFragment = getUpFragment(maxUp)) != null && !myPinnedNodes.contains(maxUp)) {
maxUp = shortFragment.upNodeIndex;
- if (startFragment.upNodeIndex - maxUp > bound)
- break;
+ if (startFragment.upNodeIndex - maxUp > bound) break;
}
if (maxUp != startFragment.upNodeIndex || maxDown != startFragment.downNodeIndex) {
return new GraphFragment(maxUp, maxDown);
- } else {
+ }
+ else {
// start fragment is Simple
- if (myLinearGraph.getNodes(startFragment.upNodeIndex, DOWN).size() != 1)
- return startFragment;
+ if (myLinearGraph.getNodes(startFragment.upNodeIndex, DOWN).size() != 1) return startFragment;
}
return null;
}
@@ -172,8 +167,7 @@ public class LinearFragmentGenerator {
}
}
- if (nextBlackNode == -1)
- return null;
+ if (nextBlackNode == -1) return null;
if (grayNodes.size() == 1) {
endNode = nextBlackNode;
@@ -181,18 +175,19 @@ public class LinearFragmentGenerator {
}
List nextGrayNodes = getNextNodes.fun(nextBlackNode);
- if (nextGrayNodes.isEmpty() || thisNodeCantBeInMiddle.contains(nextBlackNode))
- return null;
+ if (nextGrayNodes.isEmpty() || thisNodeCantBeInMiddle.contains(nextBlackNode)) return null;
blackNodes.add(nextBlackNode);
grayNodes.remove(nextBlackNode);
grayNodes.addAll(nextGrayNodes);
}
- if (endNode != -1)
+ if (endNode != -1) {
return Pair.create(startNode, endNode);
- else
+ }
+ else {
return null;
+ }
}
public static class GraphFragment {
diff --git a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/linearBek/LinearBekController.java b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/linearBek/LinearBekController.java
index 509d6fe5b665..bf5fae590657 100644
--- a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/linearBek/LinearBekController.java
+++ b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/linearBek/LinearBekController.java
@@ -41,11 +41,12 @@ public class LinearBekController extends CascadeLinearGraphController {
public LinearBekController(@NotNull BekBaseLinearGraphController controller, @NotNull PermanentGraphInfo permanentGraphInfo) {
super(controller, permanentGraphInfo);
myCompiledGraph = new LinearBekGraph(getDelegateLinearGraphController().getCompiledGraph());
- myLinearBekGraphBuilder = new LinearBekGraphBuilder(myCompiledGraph, new BekGraphLayout(permanentGraphInfo.getPermanentGraphLayout(), controller.getBekIntMap()));
+ myLinearBekGraphBuilder = new LinearBekGraphBuilder(myCompiledGraph, new BekGraphLayout(permanentGraphInfo.getPermanentGraphLayout(),
+ controller.getBekIntMap()));
long start = System.currentTimeMillis();
myLinearBekGraphBuilder.collapseAll();
- System.err.println((System.currentTimeMillis() - start) / 1000.0 + " sec");
+ System.err.println("Linear bek took " + (System.currentTimeMillis() - start) / 1000.0 + " sec");
}
@NotNull
diff --git a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/linearBek/LinearBekGraph.java b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/linearBek/LinearBekGraph.java
index a1441b40c970..0a653b4606bf 100644
--- a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/linearBek/LinearBekGraph.java
+++ b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/linearBek/LinearBekGraph.java
@@ -27,7 +27,10 @@ import com.intellij.vcs.log.graph.utils.LinearGraphUtils;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.Set;
public class LinearBekGraph implements LinearGraph {
@NotNull protected final LinearGraph myGraph;
@@ -103,7 +106,7 @@ public class LinearBekGraph implements LinearGraph {
}
});
- for (GraphEdge graphEdge: downDottedEdges) {
+ for (GraphEdge graphEdge : downDottedEdges) {
assert graphEdge.getType() == GraphEdgeType.DOTTED;
addedEdges.addAll(expandEdge(graphEdge));
}
diff --git a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/linearBek/LinearBekGraphBuilder.java b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/linearBek/LinearBekGraphBuilder.java
index a14ec24a273a..94eb8c89d419 100644
--- a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/linearBek/LinearBekGraphBuilder.java
+++ b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/linearBek/LinearBekGraphBuilder.java
@@ -17,7 +17,6 @@ package com.intellij.vcs.log.graph.linearBek;
import com.intellij.util.Function;
import com.intellij.util.containers.ContainerUtil;
-import com.intellij.util.containers.ContainerUtilRt;
import com.intellij.vcs.log.graph.api.EdgeFilter;
import com.intellij.vcs.log.graph.api.GraphLayout;
import com.intellij.vcs.log.graph.api.elements.GraphEdge;
@@ -30,7 +29,10 @@ import gnu.trove.TIntIterator;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
-import java.util.*;
+import java.util.Comparator;
+import java.util.List;
+import java.util.PriorityQueue;
+import java.util.Set;
class LinearBekGraphBuilder {
private static final int MAX_BLOCK_SIZE = 200;
@@ -246,6 +248,7 @@ class LinearBekGraphBuilder {
myBlockBody.add(body);
}
+ @NotNull
public TIntHashSet getTails() {
return myTails;
}
diff --git a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/utils/DfsUtil.java b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/utils/DfsUtil.java
index 6ebb3ca7fef4..68d5480e2805 100644
--- a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/utils/DfsUtil.java
+++ b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/utils/DfsUtil.java
@@ -37,7 +37,8 @@ public class DfsUtil {
int nextNode = nextNodeFun.fun(myStack.peek());
if (nextNode != NextNode.NODE_NOT_FOUND) {
myStack.push(nextNode);
- } else {
+ }
+ else {
myStack.pop();
}
}
diff --git a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/utils/Flags.java b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/utils/Flags.java
index fdd792d066b7..d2d9b632a734 100644
--- a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/utils/Flags.java
+++ b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/utils/Flags.java
@@ -20,7 +20,10 @@ package com.intellij.vcs.log.graph.utils;
*/
public interface Flags {
int size();
+
boolean get(int index);
+
void set(int index, boolean value);
+
void setAll(boolean value);
}
diff --git a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/utils/IntIntMultiMap.java b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/utils/IntIntMultiMap.java
index 1b8b37d678bf..333dd105c79e 100644
--- a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/utils/IntIntMultiMap.java
+++ b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/utils/IntIntMultiMap.java
@@ -32,11 +32,11 @@ public class IntIntMultiMap {
if (values == null) {
int[] newValues = {value};
myKeyToArrayMap.put(key, newValues);
- } else {
+ }
+ else {
int[] newValues = new int[values.length + 1];
for (int i = 0; i < values.length; i++) {
- if (values[i] == value)
- return;
+ if (values[i] == value) return;
newValues[i] = values[i];
}
newValues[newValues.length - 1] = value;
@@ -47,16 +47,14 @@ public class IntIntMultiMap {
public void remove(int key, int value) {
int removeIndex = -1;
int[] values = myKeyToArrayMap.get(key);
- if (values == null)
- return;
+ if (values == null) return;
for (int i = 0; i < values.length; i++) {
if (values[i] == value) {
removeIndex = i;
break;
}
}
- if (removeIndex == -1)
- return;
+ if (removeIndex == -1) return;
if (values.length == 1) {
myKeyToArrayMap.remove(key);
@@ -64,11 +62,13 @@ public class IntIntMultiMap {
}
int[] newValues = new int[values.length - 1];
- for (int i = 0; i < newValues.length; i++) {
- if (i >= removeIndex)
+ for (int i = 0; i < newValues.length; i++) {
+ if (i >= removeIndex) {
newValues[i] = values[i + 1];
- else
+ }
+ else {
newValues[i] = values[i];
+ }
}
myKeyToArrayMap.put(key, newValues);
}
@@ -93,10 +93,12 @@ public class IntIntMultiMap {
@NotNull
public int[] getAsArray(int key) {
int[] result = myKeyToArrayMap.get(key);
- if (result == null)
+ if (result == null) {
return EMPTY;
- else
+ }
+ else {
return result;
+ }
}
public boolean isEmpty() {
diff --git a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/utils/IntList.java b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/utils/IntList.java
index e62f12f7ba93..110d84202730 100644
--- a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/utils/IntList.java
+++ b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/utils/IntList.java
@@ -20,5 +20,6 @@ package com.intellij.vcs.log.graph.utils;
*/
public interface IntList {
int size();
+
int get(int index);
}
diff --git a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/utils/IntToIntMap.java b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/utils/IntToIntMap.java
index 571d5fed9245..237de084b36c 100644
--- a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/utils/IntToIntMap.java
+++ b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/utils/IntToIntMap.java
@@ -20,7 +20,9 @@ package com.intellij.vcs.log.graph.utils;
*/
public interface IntToIntMap {
int shortSize();
+
int longSize();
+
int getLongIndex(int shortIndex); // must be very fast
/**
diff --git a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/utils/TimestampGetter.java b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/utils/TimestampGetter.java
index 7f2d9b99ca13..5433318bfb06 100644
--- a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/utils/TimestampGetter.java
+++ b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/utils/TimestampGetter.java
@@ -21,6 +21,7 @@ package com.intellij.vcs.log.graph.utils;
public interface TimestampGetter {
int size();
+
long getTimestamp(int index);
}
diff --git a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/utils/UnsignedBitSet.java b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/utils/UnsignedBitSet.java
index 1b08a5f29143..584c2e1bb596 100644
--- a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/utils/UnsignedBitSet.java
+++ b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/utils/UnsignedBitSet.java
@@ -20,10 +20,8 @@ import org.jetbrains.annotations.NotNull;
import java.util.BitSet;
public class UnsignedBitSet implements Cloneable {
- @NotNull
- private final BitSet myPositiveSet;
- @NotNull
- private final BitSet myNegativeSet;
+ @NotNull private final BitSet myPositiveSet;
+ @NotNull private final BitSet myNegativeSet;
public UnsignedBitSet(@NotNull BitSet positiveSet, @NotNull BitSet negativeSet) {
myPositiveSet = positiveSet;
@@ -39,21 +37,26 @@ public class UnsignedBitSet implements Cloneable {
}
public void set(int bitIndex, boolean value) {
- if (bitIndex >= 0)
+ if (bitIndex >= 0) {
myPositiveSet.set(bitIndex, value);
- else
+ }
+ else {
myNegativeSet.set(toPositive(bitIndex), value);
+ }
}
// boundaries included
public void set(int fromIndex, int toIndex, boolean value) {
- if (fromIndex > toIndex)
+ if (fromIndex > toIndex) {
throw new IndexOutOfBoundsException("fromIndex: " + fromIndex +
" > toIndex: " + toIndex);
- if (fromIndex >= 0)
+ }
+ if (fromIndex >= 0) {
myPositiveSet.set(fromIndex, toIndex + 1, value);
- else if (toIndex < 0)
+ }
+ else if (toIndex < 0) {
myNegativeSet.set(toPositive(toIndex), toPositive(fromIndex) + 1, value);
+ }
else {
myPositiveSet.set(0, toIndex + 1, value);
myNegativeSet.set(toPositive(-1), toPositive(fromIndex) + 1, value);
@@ -61,10 +64,12 @@ public class UnsignedBitSet implements Cloneable {
}
public boolean get(int bitIndex) {
- if (bitIndex >= 0)
+ if (bitIndex >= 0) {
return myPositiveSet.get(bitIndex);
- else
+ }
+ else {
return myNegativeSet.get(toPositive(bitIndex));
+ }
}
@Override
diff --git a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/utils/impl/AbstractIntToIntMap.java b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/utils/impl/AbstractIntToIntMap.java
index cc9541ab8f5f..561bcf88b009 100644
--- a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/utils/impl/AbstractIntToIntMap.java
+++ b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/utils/impl/AbstractIntToIntMap.java
@@ -24,15 +24,15 @@ public abstract class AbstractIntToIntMap implements IntToIntMap {
public int getShortIndex(int longIndex) {
checkLongIndex(longIndex);
- if (shortSize() == 0 || getLongIndex(0) > longIndex)
- return 0;
+ if (shortSize() == 0 || getLongIndex(0) > longIndex) return 0;
int a = 0;
int b = shortSize() - 1;
while (b > a + 1) {
int middle = (a + b) / 2;
if (getLongIndex(middle) <= longIndex) {
a = middle;
- } else {
+ }
+ else {
b = middle;
}
}
@@ -40,18 +40,21 @@ public abstract class AbstractIntToIntMap implements IntToIntMap {
}
protected void checkLongIndex(int longIndex) {
- if (longIndex < 0 || longIndex >= longSize())
+ if (longIndex < 0 || longIndex >= longSize()) {
throw new IndexOutOfBoundsException("LongSize is: " + longSize() + ", but longIndex: " + longIndex);
+ }
}
protected void checkShortIndex(int shortIndex) {
- if (shortIndex < 0 || shortIndex >= shortSize())
+ if (shortIndex < 0 || shortIndex >= shortSize()) {
throw new IndexOutOfBoundsException("ShortSize is: " + shortSize() + ", but shortIndex: " + shortIndex);
+ }
}
protected void checkUpdateParameters(int startLongIndex, int endLongIndex) {
- if (startLongIndex < 0 || endLongIndex < startLongIndex || endLongIndex >= longSize())
+ if (startLongIndex < 0 || endLongIndex < startLongIndex || endLongIndex >= longSize()) {
throw new IllegalArgumentException(
- "ShortSize is: " + shortSize() + ", but updateRequest is: (" + startLongIndex +", " + endLongIndex + ")");
+ "ShortSize is: " + shortSize() + ", but updateRequest is: (" + startLongIndex + ", " + endLongIndex + ")");
+ }
}
}
diff --git a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/utils/impl/BitSetFlags.java b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/utils/impl/BitSetFlags.java
index c3e59205126e..4b1e74856d25 100644
--- a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/utils/impl/BitSetFlags.java
+++ b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/utils/impl/BitSetFlags.java
@@ -25,21 +25,18 @@ public class BitSetFlags implements Flags {
private final int mySize;
- @NotNull
- private final BitSet myBitSet;
+ @NotNull private final BitSet myBitSet;
// default value is false
public BitSetFlags(int size) {
- if (size < 0)
- throw new NegativeArraySizeException("size < 0: " + size);
+ if (size < 0) throw new NegativeArraySizeException("size < 0: " + size);
mySize = size;
myBitSet = new BitSet();
}
public BitSetFlags(int size, boolean defaultValue) {
this(size);
- if (defaultValue)
- setAll(true);
+ if (defaultValue) setAll(true);
}
@Override
@@ -65,10 +62,8 @@ public class BitSetFlags implements Flags {
}
private void checkRange(int index) {
- if (index < 0)
- throw new IndexOutOfBoundsException("index < 0:" + index);
- if (index >= mySize)
- throw new IndexOutOfBoundsException("index: " + index + " >= mySize: " + mySize);
+ if (index < 0) throw new IndexOutOfBoundsException("index < 0:" + index);
+ if (index >= mySize) throw new IndexOutOfBoundsException("index: " + index + " >= mySize: " + mySize);
}
diff --git a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/utils/impl/ByteArrayUtils.java b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/utils/impl/ByteArrayUtils.java
index aa93a65c45d9..2a2513393629 100644
--- a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/utils/impl/ByteArrayUtils.java
+++ b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/utils/impl/ByteArrayUtils.java
@@ -35,9 +35,8 @@ class ByteArrayUtils {
if (value < 0) value = ~value;
value >>= BYTE_OFFSET - 1;
- for (int i = 1; i < 4; i++) {
- if (value == 0)
- return i;
+ for (int i = 1; i < 4; i++) {
+ if (value == 0) return i;
value >>= BYTE_OFFSET;
}
return 4;
@@ -45,7 +44,7 @@ class ByteArrayUtils {
public static void writeDelta(int startIndex, int value, int sizeOf, byte[] bytes) {
for (int i = sizeOf - 1; i >= 0; i--) {
- bytes[startIndex + i] = (byte) value;
+ bytes[startIndex + i] = (byte)value;
value >>= BYTE_OFFSET;
}
}
@@ -69,8 +68,7 @@ class ByteArrayUtils {
}
public static int groundPointCount(int arraySize, int blockSize) {
- if (arraySize == 0)
- return 1;
+ if (arraySize == 0) return 1;
return (arraySize - 1) / blockSize + 1;
}
diff --git a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/utils/impl/CompressedIntList.java b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/utils/impl/CompressedIntList.java
index f609fc7e5cce..778d123cbdb2 100644
--- a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/utils/impl/CompressedIntList.java
+++ b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/utils/impl/CompressedIntList.java
@@ -44,7 +44,7 @@ public class CompressedIntList implements IntList {
@NotNull
public static IntList newInstance(final IntList delegateList, final int blockSize) {
- if (blockSize < 1) throw new IllegalArgumentException("Unsupported blockSize:" + blockSize);
+ if (blockSize < 1) throw new IllegalArgumentException("Unsupported blockSize:" + blockSize);
if (delegateList.size() == 0) return new FullIntList(new int[0]);
@@ -61,19 +61,18 @@ public class CompressedIntList implements IntList {
});
int[] strongValues = new int[(delegateList.size() - 1) / blockSize + 1];
- for (int i = 0; i < strongValues.length; i++)
+ for (int i = 0; i < strongValues.length; i++) {
strongValues[i] = delegateList.get(i * blockSize);
+ }
return new CompressedIntList(blockSize, strongValues, intDeltaCompressor);
}
private final int myBlockSize;
- @NotNull
- private final int[] myStrongValues;
+ @NotNull private final int[] myStrongValues;
- @NotNull
- private final IntList myCompressedDeltas;
+ @NotNull private final IntList myCompressedDeltas;
private CompressedIntList(int blockSize, @NotNull int[] strongValues, @NotNull final IntList compressedDeltas) {
myBlockSize = blockSize;
diff --git a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/utils/impl/IDIntToIntMap.java b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/utils/impl/IDIntToIntMap.java
index 18fb5ccdb3a5..a4aa03edeb31 100644
--- a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/utils/impl/IDIntToIntMap.java
+++ b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/utils/impl/IDIntToIntMap.java
@@ -20,8 +20,7 @@ import com.intellij.vcs.log.graph.utils.UpdatableIntToIntMap;
import org.jetbrains.annotations.NotNull;
public class IDIntToIntMap implements IntToIntMap {
- @NotNull
- public static final UpdatableIntToIntMap EMPTY = new EmptyIDIntToIntMap();
+ @NotNull public static final UpdatableIntToIntMap EMPTY = new EmptyIDIntToIntMap();
private final int size;
diff --git a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/utils/impl/IntDeltaCompressor.java b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/utils/impl/IntDeltaCompressor.java
index 97c2ba1d26c8..16ae06be67ff 100644
--- a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/utils/impl/IntDeltaCompressor.java
+++ b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/utils/impl/IntDeltaCompressor.java
@@ -25,15 +25,14 @@ import org.jetbrains.annotations.NotNull;
@NotNull
public static IntDeltaCompressor newInstance(@NotNull IntList deltaList) {
- if (deltaList.size() < 0)
- throw new NegativeArraySizeException("size < 0: " + deltaList.size());
+ if (deltaList.size() < 0) throw new NegativeArraySizeException("size < 0: " + deltaList.size());
int bytesAfterCompression = ByteArrayUtils.countBytesAfterCompression(deltaList);
Flags startedDeltaIndex = new BitSetFlags(bytesAfterCompression);
byte[] compressedDeltas = new byte[bytesAfterCompression];
int currentStartIndex = 0;
- for (int i = 0; i < deltaList.size(); i++) {
+ for (int i = 0; i < deltaList.size(); i++) {
startedDeltaIndex.set(currentStartIndex, true);
int value = deltaList.get(i);
@@ -59,10 +58,10 @@ import org.jetbrains.annotations.NotNull;
// [left, right)
public int getSumOfInterval(int left, int right) {
- if (left < 0 || left > right || right > size())
- throw new IllegalArgumentException("Size is: " + size() + ", but interval is: (" + left +", " + right + ")");
- if (left == size())
- return 0;
+ if (left < 0 || left > right || right > size()) {
+ throw new IllegalArgumentException("Size is: " + size() + ", but interval is: (" + left + ", " + right + ")");
+ }
+ if (left == size()) return 0;
int startIndex = myStartIndexMap.getLongIndex(left);
int sum = 0;
@@ -76,8 +75,7 @@ import org.jetbrains.annotations.NotNull;
@Override
public int get(int index) {
- if (index < 0 || index >= size())
- throw new IllegalArgumentException("Size is: " + size() + ", but index is: " + index);
+ if (index < 0 || index >= size()) throw new IllegalArgumentException("Size is: " + size() + ", but index is: " + index);
int startIndex = myStartIndexMap.getLongIndex(index);
int sizeOf = getNextStartIndex(startIndex) - startIndex;
@@ -91,8 +89,7 @@ import org.jetbrains.annotations.NotNull;
private int getNextStartIndex(int currentIndex) {
for (int i = currentIndex + 1; i < myStartedDeltaIndex.size(); i++) {
- if (myStartedDeltaIndex.get(i))
- return i;
+ if (myStartedDeltaIndex.get(i)) return i;
}
return myStartedDeltaIndex.size();
}
diff --git a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/utils/impl/IntTimestampGetter.java b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/utils/impl/IntTimestampGetter.java
index 140438565ca4..f2edc376b3aa 100644
--- a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/utils/impl/IntTimestampGetter.java
+++ b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/utils/impl/IntTimestampGetter.java
@@ -37,14 +37,13 @@ public class IntTimestampGetter implements TimestampGetter {
@NotNull
public static IntTimestampGetter newInstance(@NotNull TimestampGetter delegateGetter, int blockSize) {
- if (delegateGetter.size() < 0)
- throw new NegativeArraySizeException("delegateGetter.size() < 0: " + delegateGetter.size());
- if (delegateGetter.size() == 0)
- throw new IllegalArgumentException("Empty TimestampGetter not supported");
+ if (delegateGetter.size() < 0) throw new NegativeArraySizeException("delegateGetter.size() < 0: " + delegateGetter.size());
+ if (delegateGetter.size() == 0) throw new IllegalArgumentException("Empty TimestampGetter not supported");
long[] saveTimestamps = new long[(delegateGetter.size() - 1) / blockSize + 1];
- for (int i = 0; i < saveTimestamps.length; i++)
+ for (int i = 0; i < saveTimestamps.length; i++) {
saveTimestamps[i] = delegateGetter.getTimestamp(blockSize * i);
+ }
Map brokenDeltas = new HashMap();
int[] deltas = new int[delegateGetter.size()];
@@ -54,19 +53,16 @@ public class IntTimestampGetter implements TimestampGetter {
long delta = delegateGetter.getTimestamp(i) - delegateGetter.getTimestamp(blockIndex);
int intDelta = deltaToInt(delta);
deltas[i] = intDelta;
- if (intDelta == BROKEN_DELTA)
- brokenDeltas.put(i, delta);
+ if (intDelta == BROKEN_DELTA) brokenDeltas.put(i, delta);
}
return new IntTimestampGetter(deltas, blockSize, saveTimestamps, brokenDeltas);
}
private static int deltaToInt(long delta) {
- if (delta >= 0 && delta <= MAX_DELTA)
- return (int)delta;
+ if (delta >= 0 && delta <= MAX_DELTA) return (int)delta;
- if (delta < 0 && -delta <= MAX_DELTA)
- return (int)delta;
+ if (delta < 0 && -delta <= MAX_DELTA) return (int)delta;
return BROKEN_DELTA;
}
@@ -74,8 +70,7 @@ public class IntTimestampGetter implements TimestampGetter {
// myDeltas[i] = getTimestamp(i + 1) - getTimestamp(i)
private final IntList myDeltas;
- @NotNull
- private final Map myBrokenDeltas;
+ @NotNull private final Map myBrokenDeltas;
private final int myBlockSize;
@@ -104,16 +99,13 @@ public class IntTimestampGetter implements TimestampGetter {
private long getDelta(int index) {
int delta = myDeltas.get(index);
- if (delta != BROKEN_DELTA)
- return delta;
+ if (delta != BROKEN_DELTA) return delta;
return myBrokenDeltas.get(index);
}
private void checkRange(int index) {
- if (index < 0)
- throw new IndexOutOfBoundsException("index < 0:" + index);
- if (index >= size())
- throw new IndexOutOfBoundsException("index: " + index + " >= size: " + size());
+ if (index < 0) throw new IndexOutOfBoundsException("index < 0:" + index);
+ if (index >= size()) throw new IndexOutOfBoundsException("index: " + index + " >= size: " + size());
}
}
diff --git a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/utils/impl/ListIntToIntMap.java b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/utils/impl/ListIntToIntMap.java
index af1605196373..692335b30888 100644
--- a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/utils/impl/ListIntToIntMap.java
+++ b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/utils/impl/ListIntToIntMap.java
@@ -40,19 +40,15 @@ public class ListIntToIntMap extends AbstractIntToIntMap implements UpdatableInt
}
/**
- *
- * @param blockSize
- * memory usage is: longSize / blockSize;
- * getLongIndex access need: log(longSize) + blockSize
- * getShortIndex access need: blockSize
+ * @param blockSize memory usage is: longSize / blockSize;
+ * getLongIndex access need: log(longSize) + blockSize
+ * getShortIndex access need: blockSize
*/
@NotNull
public static UpdatableIntToIntMap newInstance(@NotNull final BooleanFunction thisIsVisible, final int longSize, int blockSize) {
- if (longSize < 0)
- throw new NegativeArraySizeException("size < 0: " + longSize);
+ if (longSize < 0) throw new NegativeArraySizeException("size < 0: " + longSize);
- if (longSize == 0)
- return IDIntToIntMap.EMPTY;
+ if (longSize == 0) return IDIntToIntMap.EMPTY;
int sumSize = (longSize - 1) / blockSize + 1;
ListIntToIntMap listIntToIntMap = new ListIntToIntMap(thisIsVisible, longSize, blockSize, new int[sumSize]);
@@ -60,8 +56,7 @@ public class ListIntToIntMap extends AbstractIntToIntMap implements UpdatableInt
return listIntToIntMap;
}
- @NotNull
- final BooleanFunction myThisIsVisible;
+ @NotNull final BooleanFunction myThisIsVisible;
private final int myLongSize;
@@ -97,23 +92,22 @@ public class ListIntToIntMap extends AbstractIntToIntMap implements UpdatableInt
int b = mySubSumOfBlocks.length - 1;
while (b > a) {
int middle = (a + b) / 2;
- if (mySubSumOfBlocks[middle] <= shortIndex)
+ if (mySubSumOfBlocks[middle] <= shortIndex) {
a = middle + 1;
- else
+ }
+ else {
b = middle;
+ }
}
assert a == b;
int blockIndex = a;
int prefVisibleCount = 0;
- if (blockIndex > 0)
- prefVisibleCount = mySubSumOfBlocks[blockIndex - 1];
+ if (blockIndex > 0) prefVisibleCount = mySubSumOfBlocks[blockIndex - 1];
for (int longIndex = blockIndex * myBlockSize; longIndex < myLongSize; longIndex++) {
- if (myThisIsVisible.fun(longIndex))
- prefVisibleCount++;
- if (prefVisibleCount > shortIndex)
- return longIndex;
+ if (myThisIsVisible.fun(longIndex)) prefVisibleCount++;
+ if (prefVisibleCount > shortIndex) return longIndex;
}
throw new IllegalAccessError("This should never happen!");
@@ -125,25 +119,25 @@ public class ListIntToIntMap extends AbstractIntToIntMap implements UpdatableInt
int blockIndex = getRelevantSumIndex(longIndex);
int countVisible = calculateSumForBlock(blockIndex, longIndex);
- if (countVisible > 0)
+ if (countVisible > 0) {
return countVisible - 1;
- else
+ }
+ else {
return 0;
+ }
}
// for calculate sum used blocks with index less that blockIndex
private int calculateSumForBlock(int blockIndex, int lastLongIndex) {
int sum = 0;
- if (blockIndex > 0)
- sum = mySubSumOfBlocks[blockIndex - 1];
+ if (blockIndex > 0) sum = mySubSumOfBlocks[blockIndex - 1];
for (int longIndex = blockIndex * myBlockSize; longIndex <= lastLongIndex; longIndex++) {
- if (myThisIsVisible.fun(longIndex))
- sum++;
+ if (myThisIsVisible.fun(longIndex)) sum++;
}
return sum;
}
-
+
private void updateSumWithCorrectPrevious(int blockIndex) {
int endIndex = Math.min(myLongSize, (blockIndex + 1) * myBlockSize);
@@ -157,12 +151,14 @@ public class ListIntToIntMap extends AbstractIntToIntMap implements UpdatableInt
int endSumIndex = getRelevantSumIndex(endLongIndex);
int prevEndSum = mySubSumOfBlocks[endSumIndex];
- for (int blockIndex = startSumIndex; blockIndex <= endSumIndex; blockIndex++)
+ for (int blockIndex = startSumIndex; blockIndex <= endSumIndex; blockIndex++) {
updateSumWithCorrectPrevious(blockIndex);
+ }
int sumDelta = mySubSumOfBlocks[endSumIndex] - prevEndSum;
- for (int blockIndex = endSumIndex + 1; blockIndex < mySubSumOfBlocks.length; blockIndex++)
+ for (int blockIndex = endSumIndex + 1; blockIndex < mySubSumOfBlocks.length; blockIndex++) {
mySubSumOfBlocks[blockIndex] += sumDelta;
+ }
}
diff --git a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/utils/impl/PermanentListIntToIntMap.java b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/utils/impl/PermanentListIntToIntMap.java
index 24ce48f2555f..8b5d4595a735 100644
--- a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/utils/impl/PermanentListIntToIntMap.java
+++ b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/utils/impl/PermanentListIntToIntMap.java
@@ -29,10 +29,8 @@ public class PermanentListIntToIntMap extends AbstractIntToIntMap implements Int
@NotNull
public static IntToIntMap newInstance(@NotNull final Flags visibleIndexes, int shortSize, int blockSize) {
- if (shortSize < 0)
- throw new NegativeArraySizeException("shortSize < 0: " + shortSize);
- if (shortSize == 0)
- return createEmptyIntToIntMap(visibleIndexes);
+ if (shortSize < 0) throw new NegativeArraySizeException("shortSize < 0: " + shortSize);
+ if (shortSize == 0) return createEmptyIntToIntMap(visibleIndexes);
int[] strongShortIndexes = new int[(shortSize - 1) / blockSize + 1];
@@ -41,8 +39,7 @@ public class PermanentListIntToIntMap extends AbstractIntToIntMap implements Int
if (visibleIndexes.get(longIndex)) {
currentShortIndex++;
- if (currentShortIndex % blockSize == 0)
- strongShortIndexes[currentShortIndex / blockSize] = longIndex;
+ if (currentShortIndex % blockSize == 0) strongShortIndexes[currentShortIndex / blockSize] = longIndex;
}
}
@@ -74,15 +71,13 @@ public class PermanentListIntToIntMap extends AbstractIntToIntMap implements Int
};
}
- @NotNull
- private final Flags myVisibleIndexes;
+ @NotNull private final Flags myVisibleIndexes;
private final int myLongSize;
private final int myShortSize;
private final int myBlockSize;
- @NotNull
- private final int[] myStrongShortIndexes;
+ @NotNull private final int[] myStrongShortIndexes;
private PermanentListIntToIntMap(@NotNull Flags visibleIndexes, int shortSize, int blockSize, @NotNull int[] strongShortIndexes) {
myVisibleIndexes = visibleIndexes;
@@ -111,13 +106,11 @@ public class PermanentListIntToIntMap extends AbstractIntToIntMap implements Int
int sub = shortIndex - strongIndex * myBlockSize;
for (int longIndex = myStrongShortIndexes[strongIndex]; longIndex < myLongSize; longIndex++) {
- if (myVisibleIndexes.get(longIndex))
- sub--;
- if (sub == -1)
- return longIndex;
+ if (myVisibleIndexes.get(longIndex)) sub--;
+ if (sub == -1) return longIndex;
}
- throw new IllegalStateException("Not found long index for short index: " + shortIndex
- + ". Long & short size is: " + myLongSize + ", " + myShortSize + ".");
+ throw new IllegalStateException(
+ "Not found long index for short index: " + shortIndex + ". Long & short size is: " + myLongSize + ", " + myShortSize + ".");
}
}
diff --git a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/utils/impl/SetListenerController.java b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/utils/impl/SetListenerController.java
index 347c1511924e..86126978c023 100644
--- a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/utils/impl/SetListenerController.java
+++ b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/utils/impl/SetListenerController.java
@@ -45,7 +45,8 @@ public class SetListenerController implements ListenerController listenerConsumer) {
- for (Listener listener : myListeners)
+ for (Listener listener : myListeners) {
listenerConsumer.consume(listener);
+ }
}
}
diff --git a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/utils/impl/SmartDeltaCompressor.java b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/utils/impl/SmartDeltaCompressor.java
index cc3cee390fcf..e3a62579e480 100644
--- a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/utils/impl/SmartDeltaCompressor.java
+++ b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/utils/impl/SmartDeltaCompressor.java
@@ -24,8 +24,7 @@ public class SmartDeltaCompressor implements IntList {
@NotNull
public static SmartDeltaCompressor newInstance(@NotNull IntList deltaList) {
- if (deltaList.size() < 0)
- throw new NegativeArraySizeException("size < 0: " + deltaList.size());
+ if (deltaList.size() < 0) throw new NegativeArraySizeException("size < 0: " + deltaList.size());
int bytesAfterCompression = countBytesAfterCompression(deltaList);
byte[] deltas = new byte[bytesAfterCompression];
@@ -43,8 +42,7 @@ public class SmartDeltaCompressor implements IntList {
for (int rem = 0; rem < 64; rem++) {
int index = main * 64 + rem;
- if (index >= size)
- break;
+ if (index >= size) break;
int sizeOf = sizeOf(deltaList.get(index));
writeDelta(offset, deltaList.get(index), sizeOf, deltas);
@@ -55,10 +53,8 @@ public class SmartDeltaCompressor implements IntList {
* 2 -> 01
* 1 -> 00
*/
- if (sizeOf == 3 || sizeOf == 4)
- majorBits[main] |= mask;
- if (sizeOf == 2 || sizeOf == 4)
- minorBits[main] |= mask;
+ if (sizeOf == 3 || sizeOf == 4) majorBits[main] |= mask;
+ if (sizeOf == 2 || sizeOf == 4) minorBits[main] |= mask;
offset += sizeOf;
}
@@ -97,7 +93,7 @@ public class SmartDeltaCompressor implements IntList {
long major = myMajorBits[main] << shift;
long minor = myMinorBits[main] << shift;
- int sizeOf = (int) (2 * (major >>> 63) + (minor >>> 63) + 1);
+ int sizeOf = (int)(2 * (major >>> 63) + (minor >>> 63) + 1);
int endIndex = myStrongIndexes[main] + 2 * Long.bitCount(major) + Long.bitCount(minor) + rem + 1;
diff --git a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/utils/impl/TreeIntToIntMap.java b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/utils/impl/TreeIntToIntMap.java
index 1629ba29726d..f016be045bca 100644
--- a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/utils/impl/TreeIntToIntMap.java
+++ b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/utils/impl/TreeIntToIntMap.java
@@ -23,19 +23,19 @@ import org.jetbrains.annotations.NotNull;
public class TreeIntToIntMap extends AbstractIntToIntMap implements UpdatableIntToIntMap {
public static UpdatableIntToIntMap newInstance(@NotNull final BooleanFunction thisIsVisible, final int longSize) {
- if (longSize < 0)
- throw new NegativeArraySizeException("size < 0: " + longSize);
+ if (longSize < 0) throw new NegativeArraySizeException("size < 0: " + longSize);
- if (longSize == 0)
- return IDIntToIntMap.EMPTY;
+ if (longSize == 0) return IDIntToIntMap.EMPTY;
int countLevels; // longSize -> countLevels: 1..2 -> 2; 3..4 -> 3; 5..8 -> 4
- if (longSize == 1)
+ if (longSize == 1) {
countLevels = 2;
- else
+ }
+ else {
countLevels = countDigits(longSize - 1) + 1;
+ }
- int[] emptyTree = new int[(1<<(countLevels - 1))];
+ int[] emptyTree = new int[(1 << (countLevels - 1))];
TreeIntToIntMap intToIntMap = new TreeIntToIntMap(thisIsVisible, longSize, countLevels, emptyTree);
intToIntMap.update(0, longSize - 1);
return intToIntMap;
@@ -50,8 +50,7 @@ public class TreeIntToIntMap extends AbstractIntToIntMap implements UpdatableInt
return count;
}
- @NotNull
- private final BooleanFunction myThisIsVisible;
+ @NotNull private final BooleanFunction myThisIsVisible;
private final int myLongSize;
private final int myCountLevels;
@@ -83,8 +82,9 @@ public class TreeIntToIntMap extends AbstractIntToIntMap implements UpdatableInt
for (int level = 0; level < myCountLevels - 1; level++) {
int child = node << 1;
int countInChildNode = getCountInNode(child);
- if (countInChildNode > shortIndex)
+ if (countInChildNode > shortIndex) {
node = child;
+ }
else {
node = child + 1;
shortIndex -= countInChildNode;
@@ -114,8 +114,7 @@ public class TreeIntToIntMap extends AbstractIntToIntMap implements UpdatableInt
}
private int updateNodeCount(int node) {
- if (isLastLevel(node))
- return getCountInLastLevel(node);
+ if (isLastLevel(node)) return getCountInLastLevel(node);
int child = node << 1;
myTree[node] = updateNodeCount(child) + updateNodeCount(child + 1);
@@ -124,17 +123,21 @@ public class TreeIntToIntMap extends AbstractIntToIntMap implements UpdatableInt
private int getCountInLastLevel(int node) {
node -= myTree.length;
- if (node < myLongSize && myThisIsVisible.fun(node))
+ if (node < myLongSize && myThisIsVisible.fun(node)) {
return 1;
- else
+ }
+ else {
return 0;
+ }
}
private int getCountInNode(int node) {
- if (isLastLevel(node))
+ if (isLastLevel(node)) {
return getCountInLastLevel(node);
- else
+ }
+ else {
return myTree[node];
+ }
}
}
diff --git a/platform/vcs-log/graph/src/com/intellij/vcs/log/printer/idea/PositionUtil.java b/platform/vcs-log/graph/src/com/intellij/vcs/log/printer/idea/PositionUtil.java
index ba8373af0414..e217102dbe96 100644
--- a/platform/vcs-log/graph/src/com/intellij/vcs/log/printer/idea/PositionUtil.java
+++ b/platform/vcs-log/graph/src/com/intellij/vcs/log/printer/idea/PositionUtil.java
@@ -50,10 +50,8 @@ public class PositionUtil {
int r = CIRCLE_RADIUS;
int x0 = WIDTH_NODE * position + WIDTH_NODE / 2;
int y0 = HEIGHT_CELL / 2;
- if (type == SimplePrintElement.Type.DOWN_ARROW)
- y0 = PrintParameters.HEIGHT_CELL - r;
- if (type == SimplePrintElement.Type.UP_ARROW)
- y0 = r;
+ if (type == SimplePrintElement.Type.DOWN_ARROW) y0 = PrintParameters.HEIGHT_CELL - r;
+ if (type == SimplePrintElement.Type.UP_ARROW) y0 = r;
return distance(x0, y0, x, y) <= r;
}
diff --git a/platform/vcs-log/graph/src/com/intellij/vcs/log/printer/idea/SimpleGraphCellPainter.java b/platform/vcs-log/graph/src/com/intellij/vcs/log/printer/idea/SimpleGraphCellPainter.java
index 9b38a4520f03..3ed8ec12f5a7 100644
--- a/platform/vcs-log/graph/src/com/intellij/vcs/log/printer/idea/SimpleGraphCellPainter.java
+++ b/platform/vcs-log/graph/src/com/intellij/vcs/log/printer/idea/SimpleGraphCellPainter.java
@@ -34,14 +34,15 @@ public class SimpleGraphCellPainter implements GraphCellPainter {
private static final Color MARK_COLOR = JBColor.BLACK;
private final Stroke usual = new BasicStroke(PrintParameters.THICK_LINE, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL);
- private final Stroke hide = new BasicStroke(PrintParameters.THICK_LINE, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL, 0, new float[]{7}, 0);
+ private final Stroke hide =
+ new BasicStroke(PrintParameters.THICK_LINE, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL, 0, new float[]{7}, 0);
private final Stroke selectUsual = new BasicStroke(PrintParameters.SELECT_THICK_LINE, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL);
- private final Stroke selectHide = new BasicStroke(PrintParameters.SELECT_THICK_LINE, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL, 0, new float[]{7}, 0);
+ private final Stroke selectHide =
+ new BasicStroke(PrintParameters.SELECT_THICK_LINE, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL, 0, new float[]{7}, 0);
private Graphics2D g2;
- @NotNull
- private final ColorGenerator myColorGenerator;
+ @NotNull private final ColorGenerator myColorGenerator;
public SimpleGraphCellPainter(@NotNull ColorGenerator colorGenerator) {
myColorGenerator = colorGenerator;
@@ -126,7 +127,8 @@ public class SimpleGraphCellPainter implements GraphCellPainter {
printer.print(MARK_COLOR);
setStroke(isUsual, false);
printer.print(usualColor);
- } else {
+ }
+ else {
setStroke(isUsual, false);
printer.print(usualColor);
}
@@ -138,8 +140,7 @@ public class SimpleGraphCellPainter implements GraphCellPainter {
}
private static boolean isUsual(PrintElement printElement) {
- if (!(printElement instanceof EdgePrintElement))
- return true;
+ if (!(printElement instanceof EdgePrintElement)) return true;
EdgePrintElement.LineStyle lineStyle = ((EdgePrintElement)printElement).getLineStyle();
return lineStyle == EdgePrintElement.LineStyle.SOLID;
}
@@ -161,7 +162,8 @@ public class SimpleGraphCellPainter implements GraphCellPainter {
if (edgePrintElement.getType() == EdgePrintElement.Type.DOWN) {
paintDownLine(from, to, color);
- } else {
+ }
+ else {
paintUpLine(from, to, color);
}
}
@@ -175,7 +177,8 @@ public class SimpleGraphCellPainter implements GraphCellPainter {
if (printElement.isSelected()) {
paintCircle(position, MARK_COLOR, true);
paintCircle(position, getColor(printElement), false);
- } else {
+ }
+ else {
paintCircle(position, getColor(printElement), false);
}
break;
@@ -198,8 +201,7 @@ public class SimpleGraphCellPainter implements GraphCellPainter {
}
}
- if (printer != null)
- drawLogic(printElement.isSelected(), isUsual(printElement), getColor(printElement), printer);
+ if (printer != null) drawLogic(printElement.isSelected(), isUsual(printElement), getColor(printElement), printer);
}
}
@@ -221,7 +223,8 @@ public class SimpleGraphCellPainter implements GraphCellPainter {
if (PositionUtil.overDownEdge(edgePrintElement.getPositionInCurrentRow(), edgePrintElement.getPositionInOtherRow(), x, y)) {
return printElement;
}
- } else {
+ }
+ else {
if (PositionUtil.overUpEdge(edgePrintElement.getPositionInOtherRow(), edgePrintElement.getPositionInCurrentRow(), x, y)) {
return printElement;
}
diff --git a/platform/vcs-log/graph/test/com/intellij/vcs/log/graph/GraphStrUtils.java b/platform/vcs-log/graph/test/com/intellij/vcs/log/graph/GraphStrUtils.java
index c7d2abb7fadb..60cbf6e53d06 100644
--- a/platform/vcs-log/graph/test/com/intellij/vcs/log/graph/GraphStrUtils.java
+++ b/platform/vcs-log/graph/test/com/intellij/vcs/log/graph/GraphStrUtils.java
@@ -35,19 +35,19 @@ import static com.intellij.vcs.log.graph.parser.EdgeNodeCharConverter.toChar;
public class GraphStrUtils {
- public static final Comparator GRAPH_ELEMENT_COMPARATOR = new GraphElementComparatorByLayoutIndex(new NotNullFunction() {
- @NotNull
- @Override
- public Integer fun(Integer nodeIndex) {
- return 0;
- }
- });
+ public static final Comparator GRAPH_ELEMENT_COMPARATOR =
+ new GraphElementComparatorByLayoutIndex(new NotNullFunction() {
+ @NotNull
+ @Override
+ public Integer fun(Integer nodeIndex) {
+ return 0;
+ }
+ });
public static String commitsInfoToStr(PermanentCommitsInfo commitsInfo, int size, Function toStr) {
StringBuilder s = new StringBuilder();
for (int i = 0; i < size; i++) {
- if (i != 0)
- s.append("\n");
+ if (i != 0) s.append("\n");
CommitId commitId = commitsInfo.getCommitId(i);
int commitIndex = commitsInfo.getNodeId(commitId);
@@ -63,8 +63,7 @@ public class GraphStrUtils {
public static String permanentGraphLayoutModelToStr(GraphLayout graphLayout, int nodesCount) {
StringBuilder s = new StringBuilder();
for (int nodeIndex = 0; nodeIndex < nodesCount; nodeIndex++) {
- if (nodeIndex != 0)
- s.append("\n");
+ if (nodeIndex != 0) s.append("\n");
s.append(graphLayout.getLayoutIndex(nodeIndex)).append(CommitParser.SEPARATOR).append(graphLayout.getOneOfHeadNodeIndex(nodeIndex));
}
@@ -74,8 +73,7 @@ public class GraphStrUtils {
public static String containingBranchesGetterToStr(ContainingBranchesGetter containingBranchesGetter, int nodesCount) {
StringBuilder s = new StringBuilder();
for (int nodeIndex = 0; nodeIndex < nodesCount; nodeIndex++) {
- if (nodeIndex != 0)
- s.append("\n");
+ if (nodeIndex != 0) s.append("\n");
List branchNodeIndexes = new ArrayList(containingBranchesGetter.getBranchNodeIndexes(nodeIndex));
if (branchNodeIndexes.isEmpty()) {
@@ -86,10 +84,12 @@ public class GraphStrUtils {
Collections.sort(branchNodeIndexes);
boolean first = true;
for (int branchNodeIndex : branchNodeIndexes) {
- if (first)
+ if (first) {
first = false;
- else
+ }
+ else {
s.append(" ");
+ }
s.append(branchNodeIndex);
}
@@ -100,8 +100,7 @@ public class GraphStrUtils {
public static String edgesInRowToStr(@NotNull EdgesInRowGenerator edgesInRowGenerator, int nodesCount) {
StringBuilder s = new StringBuilder();
for (int i = 0; i < nodesCount; i++) {
- if (i > 0)
- s.append("\n");
+ if (i > 0) s.append("\n");
Set edgesInRow = edgesInRowGenerator.getEdgesInRow(i);
s.append(edgesToStr(edgesInRow));
}
@@ -109,8 +108,7 @@ public class GraphStrUtils {
}
public static String edgesToStr(@NotNull Set edges) {
- if (edges.isEmpty())
- return "none";
+ if (edges.isEmpty()) return "none";
List sortedEdges = new ArrayList(edges);
Collections.sort(sortedEdges, GRAPH_ELEMENT_COMPARATOR);
diff --git a/platform/vcs-log/graph/test/com/intellij/vcs/log/graph/StrUtils.kt b/platform/vcs-log/graph/test/com/intellij/vcs/log/graph/StrUtils.kt
index af7f9655f887..f857b9f174b7 100644
--- a/platform/vcs-log/graph/test/com/intellij/vcs/log/graph/StrUtils.kt
+++ b/platform/vcs-log/graph/test/com/intellij/vcs/log/graph/StrUtils.kt
@@ -28,8 +28,7 @@ import com.intellij.vcs.log.graph.impl.print.elements.PrintElementWithGraphEleme
fun LinearGraph.asString(sorted: Boolean = false): String {
val s = StringBuilder()
for (nodeIndex in 0..nodesCount() - 1) {
- if (nodeIndex > 0)
- s.append("\n");
+ if (nodeIndex > 0) s.append("\n");
val node = getGraphNode(nodeIndex)
s.append(node.asString()).append(CommitParser.SEPARATOR)
@@ -48,7 +47,7 @@ fun Int?.asString() = if (this == null) "n" else toString()
fun GraphEdge.asString(): String = "${getUpNodeIndex().asString()}:${getDownNodeIndex().asString()}:${getTargetId().asString()}_${toChar(getType())}"
-fun GraphElement.asString(): String = when(this) {
+fun GraphElement.asString(): String = when (this) {
is GraphNode -> asString()
is GraphEdge -> asString()
else -> throw IllegalArgumentException("Uncown type of PrintElement: $this")
@@ -61,7 +60,7 @@ fun PrintElementWithGraphElement.asString(): String {
val color = getColorId()
val pos = getPositionInCurrentRow()
val sel = if (isSelected()) "Select" else "Unselect"
- return when(this) {
+ return when (this) {
is SimplePrintElement -> {
val t = getType()
"Simple:${t}|-$row:${pos}|-$color:${sel}($element)"
@@ -83,16 +82,14 @@ fun PrintElementGenerator.asString(size: Int): String {
val s = StringBuilder()
for (row in 0..size - 1) {
- if (row > 0)
- s.append("\n")
+ if (row > 0) s.append("\n")
val elements = getPrintElements(row).sortBy {
val pos = it.getPositionInCurrentRow()
if (it is SimplePrintElement) {
1024 * pos + it.getType().ordinal()
} else if (it is EdgePrintElement) {
1024 * pos + (it.getType().ordinal() + 1) * 64 + it.getPositionInOtherRow()
- } else
- 0
+ } else 0
}
elements.map { it.asString() }.joinTo(s, separator = "\n ")
}
diff --git a/platform/vcs-log/graph/test/com/intellij/vcs/log/graph/TestGraphBuilder.kt b/platform/vcs-log/graph/test/com/intellij/vcs/log/graph/TestGraphBuilder.kt
index 9517c9213af2..65f30c8784dd 100644
--- a/platform/vcs-log/graph/test/com/intellij/vcs/log/graph/TestGraphBuilder.kt
+++ b/platform/vcs-log/graph/test/com/intellij/vcs/log/graph/TestGraphBuilder.kt
@@ -27,7 +27,6 @@ import com.intellij.vcs.log.graph.BaseTestGraphBuilder.SimpleEdge
import com.intellij.vcs.log.graph.BaseTestGraphBuilder.SimpleNode
import com.intellij.vcs.log.graph.api.permanent.PermanentGraphInfo
import com.intellij.vcs.log.graph.api.permanent.PermanentCommitsInfo
-import com.intellij.openapi.util.Condition
import com.intellij.util.containers.ContainerUtil
import com.intellij.vcs.log.graph.utils.TimestampGetter
import com.intellij.vcs.log.graph.impl.permanent.GraphLayoutBuilder
@@ -37,8 +36,6 @@ import kotlin.test.assertNull
import com.intellij.vcs.log.graph.utils.LinearGraphUtils
import com.intellij.vcs.log.graph.api.EdgeFilter
import com.intellij.vcs.log.graph.impl.permanent.PermanentLinearGraphImpl
-import com.intellij.vcs.log.graph.utils.impl.BitSetFlags
-import com.intellij.vcs.log.graph.utils.impl.FullIntList
import com.intellij.vcs.log.graph.impl.facade.LinearGraphController
import com.intellij.vcs.log.graph.impl.facade.VisibleGraphImpl
@@ -57,7 +54,7 @@ public trait BaseTestGraphBuilder {
class SimpleNode(val nodeId: Int, val type: GraphNodeType = GraphNodeType.USUAL)
}
-public class TestGraphBuilder: BaseTestGraphBuilder {
+public class TestGraphBuilder : BaseTestGraphBuilder {
private val nodes = ArrayList()
public fun done(): LinearGraph = TestLinearGraph(nodes)
@@ -77,6 +74,7 @@ public class TestGraphBuilder: BaseTestGraphBuilder {
private fun newNode(node: SimpleNode, edges: List = listOf()) {
nodes add NodeWithEdges(node.nodeId, edges, node.type)
}
+
fun node(id: Int, vararg edge: Int) {
nodes add NodeWithEdges(id, edge.map {
SimpleEdge(it, GraphEdgeType.USUAL)
@@ -87,17 +85,17 @@ public class TestGraphBuilder: BaseTestGraphBuilder {
nodes add NodeWithEdges(id, edge.toList())
}
- private class TestLinearGraph(buildNodes: List): LinearGraph {
+ private class TestLinearGraph(buildNodes: List) : LinearGraph {
private val nodes: List
private val nodeIndexToId: Map
private val nodeIdToIndex: Map
private val edges = MultiMap()
- val SimpleEdge.toIndex: Int? get() = toNode?.let{ nodeIdToIndex[it]}
+ val SimpleEdge.toIndex: Int? get() = toNode?.let { nodeIdToIndex[it] }
;{
val idsMap = HashMap()
- nodes = buildNodes.map2 { (index, it) ->
+ nodes = buildNodes.map2 {(index, it) ->
idsMap[index] = it.nodeId
GraphNode(index, it.type)
}
@@ -133,7 +131,7 @@ public class TestGraphBuilder: BaseTestGraphBuilder {
= edges[nodeIndex].filter {
if (it.getType().isNormalEdge()) {
(LinearGraphUtils.isEdgeUp(it, nodeIndex) && filter.upNormal)
- || (LinearGraphUtils.isEdgeDown(it, nodeIndex) && filter.downNormal)
+ || (LinearGraphUtils.isEdgeDown(it, nodeIndex) && filter.downNormal)
} else {
filter.special
}
@@ -150,8 +148,7 @@ private fun LinearGraph.assertEdge(nodeIndex: Int, edge: GraphEdge) {
if (edge.getType().isNormalEdge()) {
if (nodeIndex == edge.getUpNodeIndex()) {
assertTrue(getAdjacentEdges(edge.getDownNodeIndex(), EdgeFilter.NORMAL_UP).contains(edge))
- }
- else {
+ } else {
assertTrue(nodeIndex == edge.getDownNodeIndex())
assertTrue(getAdjacentEdges(edge.getUpNodeIndex(), EdgeFilter.NORMAL_DOWN).contains(edge))
}
@@ -170,11 +167,11 @@ private fun LinearGraph.assertEdge(nodeIndex: Int, edge: GraphEdge) {
}
public fun LinearGraph.asTestGraphString(sorted: Boolean = false): String = StringBuilder {
- for(nodeIndex in 0..nodesCount() - 1) {
+ for (nodeIndex in 0..nodesCount() - 1) {
val node = getGraphNode(nodeIndex)
append(getNodeId(nodeIndex))
assertEquals(nodeIndex, node.getNodeIndex(),
- "nodeIndex: $nodeIndex, but for node with this index(nodeId: ${getNodeId(nodeIndex)}) nodeIndex: ${node.getNodeIndex()}"
+ "nodeIndex: $nodeIndex, but for node with this index(nodeId: ${getNodeId(nodeIndex)}) nodeIndex: ${node.getNodeIndex()}"
)
when (node.getType()) {
GraphNodeType.UNMATCHED -> append(".UNM")
@@ -193,11 +190,9 @@ public fun LinearGraph.asTestGraphString(sorted: Boolean = false): String = Stri
if (it.getUpNodeIndex() == nodeIndex) {
val startId = if (it.getType().isNormalEdge()) {
getNodeId(it.getDownNodeIndex()).toString()
- }
- else if (it.getTargetId() != null) {
+ } else if (it.getTargetId() != null) {
it.getTargetId().toString()
- }
- else {
+ } else {
"null"
}
@@ -252,12 +247,11 @@ class TestPermanentGraphInfo(
override fun getTimestamp(index: Int) = commitInfo.getTimestamp(graph.getNodeId(index))
}
- val graphLayout = GraphLayoutBuilder.build(graph) { (x, y) ->
+ val graphLayout = GraphLayoutBuilder.build(graph) {(x, y) ->
if (headsOrder.isEmpty()) {
graph.getNodeId(x) - graph.getNodeId(y)
- }
- else {
- val t = if (headsOrder.indexOf(x) == -1) x else if(headsOrder.indexOf(y) == -1) y else -1
+ } else {
+ val t = if (headsOrder.indexOf(x) == -1) x else if (headsOrder.indexOf(y) == -1) y else -1
if (t != -1) throw IllegalStateException("Not found headsOrder for $t node by id")
headsOrder.indexOf(x) - headsOrder.indexOf(y)
}
diff --git a/platform/vcs-log/graph/test/com/intellij/vcs/log/graph/TestGraphBuilderTest.kt b/platform/vcs-log/graph/test/com/intellij/vcs/log/graph/TestGraphBuilderTest.kt
index 0391dcfbe215..b4e69b9c0748 100644
--- a/platform/vcs-log/graph/test/com/intellij/vcs/log/graph/TestGraphBuilderTest.kt
+++ b/platform/vcs-log/graph/test/com/intellij/vcs/log/graph/TestGraphBuilderTest.kt
@@ -19,7 +19,7 @@ import org.junit.Assert.*
import org.junit.Test
-class TestGraphBuilderTest : AbstractTestWithTextFile("testGraphBuilder") {
+class TestGraphBuilderTest : AbstractTestWithTextFile("testGraphBuilder") {
fun runTest(testName: String, builder: TestGraphBuilder.() -> Unit) {
val actual = graph(builder).asString()
diff --git a/platform/vcs-log/graph/test/com/intellij/vcs/log/graph/TestGraphs.kt b/platform/vcs-log/graph/test/com/intellij/vcs/log/graph/TestGraphs.kt
index 22c58ffda65d..8be5e51dfe9f 100644
--- a/platform/vcs-log/graph/test/com/intellij/vcs/log/graph/TestGraphs.kt
+++ b/platform/vcs-log/graph/test/com/intellij/vcs/log/graph/TestGraphs.kt
@@ -54,9 +54,9 @@ object TestGraphs {
3 4 5
*/
val downTree = graph {
- 0(1,2)
- 1(3,4)
- 2(4,5)
+ 0(1, 2)
+ 1(3, 4)
+ 2(4, 5)
3()
4()
5()
@@ -71,7 +71,7 @@ object TestGraphs {
*/
val upTree = graph {
0(3)
- 1(3,4)
+ 1(3, 4)
2(4)
3(5)
4(5)
@@ -186,13 +186,13 @@ object TestGraphs {
8
*/
val twoInit = graph {
- 0(1,2)
- 1(3,4)
+ 0(1, 2)
+ 1(3, 4)
2(6)
3(5)
4(6)
- 5(7,8)
- 6(7,8)
+ 5(7, 8)
+ 6(7, 8)
7()
8()
}
diff --git a/platform/vcs-log/graph/test/com/intellij/vcs/log/graph/impl/DottedFilterEdgesGeneratorTest.kt b/platform/vcs-log/graph/test/com/intellij/vcs/log/graph/impl/DottedFilterEdgesGeneratorTest.kt
index ea8a5eedcda3..c66dc11bfb1a 100644
--- a/platform/vcs-log/graph/test/com/intellij/vcs/log/graph/impl/DottedFilterEdgesGeneratorTest.kt
+++ b/platform/vcs-log/graph/test/com/intellij/vcs/log/graph/impl/DottedFilterEdgesGeneratorTest.kt
@@ -30,7 +30,7 @@ public class DottedFilterEdgesGeneratorTest {
fun LinearGraph.assert(upIndex: Int = 0, downIndex: Int = nodesCount() - 1, result: TestGraphBuilder.() -> Unit) {
val nodesVisibility = UnsignedBitSet()
- for(nodeIndex in 0..nodesCount() - 1) {
+ for (nodeIndex in 0..nodesCount() - 1) {
val graphNode = getGraphNode(nodeIndex)
nodesVisibility.set(getNodeId(nodeIndex), graphNode.getType() == GraphNodeType.USUAL)
}
@@ -82,9 +82,9 @@ public class DottedFilterEdgesGeneratorTest {
3 4 5
*/
Test fun downTree() = graph {
- 0(1,2)
- 1.UNM(3,4)
- 2.UNM(4,5)
+ 0(1, 2)
+ 1.UNM(3, 4)
+ 2.UNM(4, 5)
3()
4()
5()
@@ -104,7 +104,7 @@ public class DottedFilterEdgesGeneratorTest {
*/
Test fun upTree() = graph {
0(3)
- 1(3,4)
+ 1(3, 4)
2(4)
3.UNM(5)
4.UNM(5)
diff --git a/platform/vcs-log/graph/test/com/intellij/vcs/log/graph/impl/EdgeStorageTest.kt b/platform/vcs-log/graph/test/com/intellij/vcs/log/graph/impl/EdgeStorageTest.kt
index 09626e5561c0..141d37698d03 100644
--- a/platform/vcs-log/graph/test/com/intellij/vcs/log/graph/impl/EdgeStorageTest.kt
+++ b/platform/vcs-log/graph/test/com/intellij/vcs/log/graph/impl/EdgeStorageTest.kt
@@ -21,11 +21,8 @@ import com.intellij.vcs.log.graph.collapsing.EdgeStorage
import com.intellij.vcs.log.graph.BaseTestGraphBuilder
import com.intellij.vcs.log.graph.BaseTestGraphBuilder.SimpleEdge
import com.intellij.vcs.log.graph.api.elements.GraphEdgeType
-import java.util.ArrayList
import com.intellij.vcs.log.graph.utils.sortR
-import com.intellij.vcs.log.graph.api.elements.GraphEdge
import com.intellij.vcs.log.graph.asString
-import com.intellij.vcs.log.graph.api.LinearGraph
import com.intellij.vcs.log.graph.api.EdgeFilter
import com.intellij.vcs.log.graph.collapsing.EdgeStorageWrapper
@@ -44,6 +41,7 @@ public class EdgeStorageTest : BaseTestGraphBuilder {
createEdge(edge.mainId, edge.additionId ?: EdgeStorage.NULL_ID, edge.edgeType)
return this
}
+
fun EdgeStorage.remove(edge: FullEdge): EdgeStorage {
removeEdge(edge.mainId, edge.additionId ?: EdgeStorage.NULL_ID, edge.edgeType)
return this
@@ -52,7 +50,7 @@ public class EdgeStorageTest : BaseTestGraphBuilder {
fun EdgeStorage.assert(s: String) = assertEquals(s, asString())
fun EdgeStorage.asString(): String = getKnownIds().sortR().map {
- adapter.getAdjacentEdges(nodeIndexById(it), EdgeFilter.ALL).map { it.asString() }.joinToString(",")
+ adapter.getAdjacentEdges(nodeIndexById(it), EdgeFilter.ALL).map { it.asString() }.joinToString(",")
}.joinToString("|-")
val EdgeStorage.adapter: EdgeStorageWrapper get() = EdgeStorageWrapper(this, nodeIndexById, nodeIdByIndex)
diff --git a/platform/vcs-log/graph/test/com/intellij/vcs/log/graph/impl/FragmentGeneratorTest.kt b/platform/vcs-log/graph/test/com/intellij/vcs/log/graph/impl/FragmentGeneratorTest.kt
index ab2ca8d3a1ab..056c66a71052 100644
--- a/platform/vcs-log/graph/test/com/intellij/vcs/log/graph/impl/FragmentGeneratorTest.kt
+++ b/platform/vcs-log/graph/test/com/intellij/vcs/log/graph/impl/FragmentGeneratorTest.kt
@@ -26,7 +26,7 @@ import com.intellij.vcs.log.graph.api.LiteLinearGraph
private val LinearGraph.lite: LiteLinearGraph get() = LinearGraphUtils.asLiteLinearGraph(this)
-private fun LinearGraph.getMiddleNodes(upNode: Int, downNode: Int) = FragmentGenerator(lite) {false}.getMiddleNodes(upNode, downNode, false)
+private fun LinearGraph.getMiddleNodes(upNode: Int, downNode: Int) = FragmentGenerator(lite) { false }.getMiddleNodes(upNode, downNode, false)
private fun Collection.assert(s: String) = assertEquals(s, sort().joinToString(","))
private fun Int?.assert(i: Int?) = assertEquals(i, this)
@@ -52,7 +52,7 @@ private fun FragmentGenerator.GreenFragment.assert(s: String)
2
*/
val simple = graph {
- 0(1,2)
+ 0(1, 2)
1(2)
2()
}
@@ -77,9 +77,9 @@ val twoBranch = graph {
3 4 5
*/
val downTree = graph {
- 0(1,2)
- 1(3,4)
- 2(4,5)
+ 0(1, 2)
+ 1(3, 4)
+ 2(4, 5)
3()
4()
5()
@@ -94,7 +94,7 @@ val downTree = graph {
*/
val upTree = graph {
0(3)
- 1(3,4)
+ 1(3, 4)
2(4)
3(5)
4(5)
@@ -116,13 +116,13 @@ val upTree = graph {
8
*/
val difficult = graph {
- 0(1,2)
- 1(3,4)
+ 0(1, 2)
+ 1(3, 4)
2(6)
3(5)
4(6)
- 5(7,8)
- 6(7,8)
+ 5(7, 8)
+ 6(7, 8)
7()
8()
}
diff --git a/platform/vcs-log/graph/test/com/intellij/vcs/log/graph/impl/permanent/ContainingBranchesTest.java b/platform/vcs-log/graph/test/com/intellij/vcs/log/graph/impl/permanent/ContainingBranchesTest.java
index 538e260bc932..c8999515b315 100644
--- a/platform/vcs-log/graph/test/com/intellij/vcs/log/graph/impl/permanent/ContainingBranchesTest.java
+++ b/platform/vcs-log/graph/test/com/intellij/vcs/log/graph/impl/permanent/ContainingBranchesTest.java
@@ -16,11 +16,11 @@
package com.intellij.vcs.log.graph.impl.permanent;
+import com.intellij.vcs.log.graph.AbstractTestWithTwoTextFile;
import com.intellij.vcs.log.graph.GraphCommit;
import com.intellij.vcs.log.graph.api.LinearGraph;
import com.intellij.vcs.log.graph.impl.CommitIdManager;
import com.intellij.vcs.log.graph.impl.facade.ContainingBranchesGetter;
-import com.intellij.vcs.log.graph.AbstractTestWithTwoTextFile;
import com.intellij.vcs.log.graph.utils.LinearGraphUtils;
import org.junit.Test;
@@ -53,8 +53,8 @@ public abstract class ContainingBranchesTest extends AbstractTestWithT
List> commits = getCommitIdManager().parseCommitList(in.substring(0, i));
LinearGraph graph = PermanentLinearGraphBuilder.newInstance(commits).build();
- ContainingBranchesGetter containingBranchesGetter = new ContainingBranchesGetter(LinearGraphUtils.asLiteLinearGraph(graph),
- parseBranchNodeIndex(in.substring(i + SEPARATOR.length())));
+ ContainingBranchesGetter containingBranchesGetter =
+ new ContainingBranchesGetter(LinearGraphUtils.asLiteLinearGraph(graph), parseBranchNodeIndex(in.substring(i + SEPARATOR.length())));
assertEquals(out, containingBranchesGetterToStr(containingBranchesGetter, graph.nodesCount()));
}
diff --git a/platform/vcs-log/graph/test/com/intellij/vcs/log/graph/impl/permanent/GraphBuilderHashIndexTest.java b/platform/vcs-log/graph/test/com/intellij/vcs/log/graph/impl/permanent/GraphBuilderHashIndexTest.java
index d372e79f1830..061705881926 100644
--- a/platform/vcs-log/graph/test/com/intellij/vcs/log/graph/impl/permanent/GraphBuilderHashIndexTest.java
+++ b/platform/vcs-log/graph/test/com/intellij/vcs/log/graph/impl/permanent/GraphBuilderHashIndexTest.java
@@ -16,10 +16,10 @@
package com.intellij.vcs.log.graph.impl.permanent;
+import com.intellij.vcs.log.graph.AbstractTestWithTwoTextFile;
import com.intellij.vcs.log.graph.GraphCommit;
import com.intellij.vcs.log.graph.api.permanent.PermanentCommitsInfo;
import com.intellij.vcs.log.graph.impl.CommitIdManager;
-import com.intellij.vcs.log.graph.AbstractTestWithTwoTextFile;
import org.junit.Test;
import java.io.IOException;
diff --git a/platform/vcs-log/graph/test/com/intellij/vcs/log/graph/impl/permanent/GraphBuilderTest.kt b/platform/vcs-log/graph/test/com/intellij/vcs/log/graph/impl/permanent/GraphBuilderTest.kt
index 009bbee0cb45..9c31f048444f 100644
--- a/platform/vcs-log/graph/test/com/intellij/vcs/log/graph/impl/permanent/GraphBuilderTest.kt
+++ b/platform/vcs-log/graph/test/com/intellij/vcs/log/graph/impl/permanent/GraphBuilderTest.kt
@@ -17,8 +17,6 @@
package com.intellij.vcs.log.graph.impl.permanent
import com.intellij.util.NotNullFunction
-import com.intellij.vcs.log.graph.AbstractTestWithTwoTextFile
-import com.intellij.vcs.log.graph.GraphCommit
import com.intellij.vcs.log.graph.*
import com.intellij.vcs.log.graph.impl.CommitIdManager
import org.junit.Test
diff --git a/platform/vcs-log/graph/test/com/intellij/vcs/log/graph/impl/print/PrintElementGeneratorTest.kt b/platform/vcs-log/graph/test/com/intellij/vcs/log/graph/impl/print/PrintElementGeneratorTest.kt
index eaa4a7f01099..da1777dcc3b3 100644
--- a/platform/vcs-log/graph/test/com/intellij/vcs/log/graph/impl/print/PrintElementGeneratorTest.kt
+++ b/platform/vcs-log/graph/test/com/intellij/vcs/log/graph/impl/print/PrintElementGeneratorTest.kt
@@ -15,12 +15,8 @@
*/
package com.intellij.vcs.log.graph.impl.print
-import com.intellij.openapi.util.Pair
import com.intellij.util.NotNullFunction
-import com.intellij.vcs.log.graph.AbstractTestWithTwoTextFile
import com.intellij.vcs.log.graph.*
-import com.intellij.vcs.log.graph.api.GraphLayout
-import com.intellij.vcs.log.graph.api.LinearGraph
import com.intellij.vcs.log.graph.api.elements.GraphEdge
import com.intellij.vcs.log.graph.api.elements.GraphElement
import com.intellij.vcs.log.graph.api.elements.GraphNode
diff --git a/platform/vcs-log/graph/test/com/intellij/vcs/log/graph/impl/print/TestGraphBuilderTest.kt b/platform/vcs-log/graph/test/com/intellij/vcs/log/graph/impl/print/TestGraphBuilderTest.kt
index 3f5f42434e31..2b7e938ca5df 100644
--- a/platform/vcs-log/graph/test/com/intellij/vcs/log/graph/impl/print/TestGraphBuilderTest.kt
+++ b/platform/vcs-log/graph/test/com/intellij/vcs/log/graph/impl/print/TestGraphBuilderTest.kt
@@ -15,9 +15,7 @@
*/
package com.intellij.vcs.log.graph.impl.print
-import com.intellij.vcs.log.graph.AbstractTestWithTwoTextFile
import com.intellij.vcs.log.graph.*
-import com.intellij.vcs.log.graph.api.LinearGraph
import com.intellij.vcs.log.graph.parser.LinearGraphParser
import org.junit.Test
diff --git a/platform/vcs-log/graph/test/com/intellij/vcs/log/graph/parser/CommitParser.java b/platform/vcs-log/graph/test/com/intellij/vcs/log/graph/parser/CommitParser.java
index 9a6b3c2bf837..92c8ed25928c 100644
--- a/platform/vcs-log/graph/test/com/intellij/vcs/log/graph/parser/CommitParser.java
+++ b/platform/vcs-log/graph/test/com/intellij/vcs/log/graph/parser/CommitParser.java
@@ -68,7 +68,7 @@ public class CommitParser {
@NotNull
public static List> parseStringCommitList(@NotNull String input) {
List> vcsCommitParentses = new ArrayList>();
- for(String line : toLines(input)) {
+ for (String line : toLines(input)) {
vcsCommitParentses.add(CommitParser.parseCommitParentsAsString(line));
}
return vcsCommitParentses;
@@ -77,7 +77,7 @@ public class CommitParser {
@NotNull
public static List> parseIntegerCommitList(@NotNull String input) {
List> vcsCommitParentses = new ArrayList>();
- for(String line : toLines(input)) {
+ for (String line : toLines(input)) {
vcsCommitParentses.add(CommitParser.parseCommitParentsAsInteger(line));
}
return vcsCommitParentses;
diff --git a/platform/vcs-log/graph/test/com/intellij/vcs/log/graph/parser/EdgeNodeCharConverter.java b/platform/vcs-log/graph/test/com/intellij/vcs/log/graph/parser/EdgeNodeCharConverter.java
index 3f8e03754ee0..fe3b7da6071b 100644
--- a/platform/vcs-log/graph/test/com/intellij/vcs/log/graph/parser/EdgeNodeCharConverter.java
+++ b/platform/vcs-log/graph/test/com/intellij/vcs/log/graph/parser/EdgeNodeCharConverter.java
@@ -47,16 +47,14 @@ public class EdgeNodeCharConverter {
@NotNull
public static GraphNodeType parseGraphNodeType(char type) {
GraphNodeType nodeType = GRAPH_NODE_TYPE_MAP.get(type);
- if (nodeType == null)
- throw new IllegalStateException("Illegal char for graph node type: " + type);
+ if (nodeType == null) throw new IllegalStateException("Illegal char for graph node type: " + type);
return nodeType;
}
@NotNull
public static GraphEdgeType parseGraphEdgeType(char type) {
GraphEdgeType nodeType = GRAPH_EDGE_TYPE_MAP.get(type);
- if (nodeType == null)
- throw new IllegalStateException("Illegal char for graph edge type: " + type);
+ if (nodeType == null) throw new IllegalStateException("Illegal char for graph edge type: " + type);
return nodeType;
}
diff --git a/platform/vcs-log/graph/test/com/intellij/vcs/log/graph/parser/LinearGraphParser.java b/platform/vcs-log/graph/test/com/intellij/vcs/log/graph/parser/LinearGraphParser.java
index d72aee8d6194..c26afa11a1c4 100644
--- a/platform/vcs-log/graph/test/com/intellij/vcs/log/graph/parser/LinearGraphParser.java
+++ b/platform/vcs-log/graph/test/com/intellij/vcs/log/graph/parser/LinearGraphParser.java
@@ -137,12 +137,12 @@ public class LinearGraphParser {
public List getAdjacentEdges(int nodeIndex, @NotNull EdgeFilter filter) {
List result = ContainerUtil.newArrayList();
- for(GraphEdge upEdge : myUpEdges.get(nodeIndex)) {
+ for (GraphEdge upEdge : myUpEdges.get(nodeIndex)) {
if (upEdge.getType().isNormalEdge() && filter.upNormal) result.add(upEdge);
if (!upEdge.getType().isNormalEdge() && filter.special) result.add(upEdge);
}
- for(GraphEdge downEdge : myDownEdges.get(nodeIndex)) {
+ for (GraphEdge downEdge : myDownEdges.get(nodeIndex)) {
if (downEdge.getType().isNormalEdge() && filter.downNormal) result.add(downEdge);
if (!downEdge.getType().isNormalEdge() && filter.special) result.add(downEdge);
}
@@ -158,15 +158,14 @@ public class LinearGraphParser {
@Override
public int getNodeId(int nodeIndex) {
- assert nodeIndex > 0 && nodeIndex < nodesCount() : "Bad nodeIndex: "+ nodeIndex;
+ assert nodeIndex > 0 && nodeIndex < nodesCount() : "Bad nodeIndex: " + nodeIndex;
return nodeIndex;
}
@Override
@Nullable
public Integer getNodeIndex(int nodeId) {
- if (nodeId >= 0 && nodeId < nodesCount())
- return nodeId;
+ if (nodeId >= 0 && nodeId < nodesCount()) return nodeId;
return null;
}
}
diff --git a/platform/vcs-log/graph/test/com/intellij/vcs/log/graph/parser/SimpleCommit.java b/platform/vcs-log/graph/test/com/intellij/vcs/log/graph/parser/SimpleCommit.java
index 590ac05e3cd1..6c2e7e8c7faa 100644
--- a/platform/vcs-log/graph/test/com/intellij/vcs/log/graph/parser/SimpleCommit.java
+++ b/platform/vcs-log/graph/test/com/intellij/vcs/log/graph/parser/SimpleCommit.java
@@ -48,10 +48,8 @@ public class SimpleCommit implements com.intellij.vcs.log.graph.GraphC
return new SimpleCommit(commitHash, parents, timestamp);
}
- @NotNull
- private final CommitId myId;
- @NotNull
- private final List myParents;
+ @NotNull private final CommitId myId;
+ @NotNull private final List myParents;
private final long myTimestamp;
public SimpleCommit(@NotNull CommitId id, @NotNull List parents, long timestamp) {
diff --git a/platform/vcs-log/graph/test/com/intellij/vcs/log/graph/utils/BitSetFlagsTest.java b/platform/vcs-log/graph/test/com/intellij/vcs/log/graph/utils/BitSetFlagsTest.java
index af852c41e9ef..ce7760b6369f 100644
--- a/platform/vcs-log/graph/test/com/intellij/vcs/log/graph/utils/BitSetFlagsTest.java
+++ b/platform/vcs-log/graph/test/com/intellij/vcs/log/graph/utils/BitSetFlagsTest.java
@@ -30,8 +30,9 @@ public class BitSetFlagsTest {
private static String toStr(@NotNull Flags flags) {
StringBuilder s = new StringBuilder();
- for(int i = 0; i < flags.size(); i++)
+ for (int i = 0; i < flags.size(); i++) {
s.append(bitToChar(flags.get(i)));
+ }
return s.toString();
}
diff --git a/platform/vcs-log/graph/test/com/intellij/vcs/log/graph/utils/CompressedIntListTest.java b/platform/vcs-log/graph/test/com/intellij/vcs/log/graph/utils/CompressedIntListTest.java
index 5d8de58cbe15..cb7a1329547f 100644
--- a/platform/vcs-log/graph/test/com/intellij/vcs/log/graph/utils/CompressedIntListTest.java
+++ b/platform/vcs-log/graph/test/com/intellij/vcs/log/graph/utils/CompressedIntListTest.java
@@ -32,14 +32,13 @@ public class CompressedIntListTest {
private static String toStr(@NotNull IntList intList) {
StringBuilder s = new StringBuilder();
for (int i = 0; i < intList.size(); i++) {
- if (i != 0)
- s.append(", ");
+ if (i != 0) s.append(", ");
s.append(intList.get(i));
}
return s.toString();
}
- private static IntList toDataList(final int ... list) {
+ private static IntList toDataList(final int... list) {
return new IntList() {
@Override
public int size() {
@@ -53,7 +52,7 @@ public class CompressedIntListTest {
};
}
- protected void runTest(int ... list) {
+ protected void runTest(int... list) {
IntList intList = CompressedIntList.newInstance(list, 3);
String expected = toStr(toDataList(list));
assertEquals(expected, toStr(intList));
@@ -107,7 +106,7 @@ public class CompressedIntListTest {
runTest(-2 * BYTE3_MAX, 0, -2 * BYTE3_MAX);
runTest(-2 * BYTE2_MAX, 0, -2 * BYTE2_MAX);
- runTest(-2 * BYTE_MAX, 0, -2 * BYTE_MAX);
+ runTest(-2 * BYTE_MAX, 0, -2 * BYTE_MAX);
runTest(BYTE_MAX, 0, BYTE_MAX);
runTest(BYTE2_MAX, 0, BYTE2_MAX);
@@ -115,7 +114,7 @@ public class CompressedIntListTest {
runTest(2 * BYTE3_MAX, 0, 2 * BYTE3_MAX);
runTest(2 * BYTE2_MAX, 0, 2 * BYTE2_MAX);
- runTest(2 * BYTE_MAX, 0, 2 * BYTE_MAX);
+ runTest(2 * BYTE_MAX, 0, 2 * BYTE_MAX);
}
@Test
diff --git a/platform/vcs-log/graph/test/com/intellij/vcs/log/graph/utils/IntTimestampGetterTest.java b/platform/vcs-log/graph/test/com/intellij/vcs/log/graph/utils/IntTimestampGetterTest.java
index 60ab7bc5f988..9248a919817c 100644
--- a/platform/vcs-log/graph/test/com/intellij/vcs/log/graph/utils/IntTimestampGetterTest.java
+++ b/platform/vcs-log/graph/test/com/intellij/vcs/log/graph/utils/IntTimestampGetterTest.java
@@ -45,14 +45,13 @@ public class IntTimestampGetterTest {
private static String toStr(@NotNull TimestampGetter timestampGetter) {
StringBuilder s = new StringBuilder();
for (int i = 0; i < timestampGetter.size(); i++) {
- if (i != 0)
- s.append(", ");
+ if (i != 0) s.append(", ");
s.append(timestampGetter.getTimestamp(i));
}
return s.toString();
}
- protected void runTest(long ... timestamp) {
+ protected void runTest(long... timestamp) {
TimestampGetter timestampGetter = create(timestamp);
IntTimestampGetter intTimestampGetter = IntTimestampGetter.newInstance(timestampGetter, BLOCK_SIZE);
assertEquals(toStr(timestampGetter), toStr(intTimestampGetter));
@@ -67,7 +66,8 @@ public class IntTimestampGetterTest {
public void checkEmpty() {
try {
runTest();
- } catch (IllegalArgumentException e) {
+ }
+ catch (IllegalArgumentException e) {
return;
}
diff --git a/platform/vcs-log/graph/test/com/intellij/vcs/log/graph/utils/PermanentListIntToIntMapTest.java b/platform/vcs-log/graph/test/com/intellij/vcs/log/graph/utils/PermanentListIntToIntMapTest.java
index 4a222eab3d49..335c207684a4 100644
--- a/platform/vcs-log/graph/test/com/intellij/vcs/log/graph/utils/PermanentListIntToIntMapTest.java
+++ b/platform/vcs-log/graph/test/com/intellij/vcs/log/graph/utils/PermanentListIntToIntMapTest.java
@@ -46,10 +46,8 @@ public class PermanentListIntToIntMapTest extends UpdatableIntToIntMapTest {
}
private static class UpdatableIntToIntMapWrapper implements UpdatableIntToIntMap {
- @NotNull
- private final Flags myFlags;
- @NotNull
- private IntToIntMap myIntToIntMap;
+ @NotNull private final Flags myFlags;
+ @NotNull private IntToIntMap myIntToIntMap;
private UpdatableIntToIntMapWrapper(@NotNull Flags flags) {
myFlags = flags;
@@ -58,9 +56,9 @@ public class PermanentListIntToIntMapTest extends UpdatableIntToIntMapTest {
private void createIntToIntMap() {
int shortSize = 0;
- for (int i = 0; i < myFlags.size(); i++)
- if (myFlags.get(i))
- shortSize++;
+ for (int i = 0; i < myFlags.size(); i++) {
+ if (myFlags.get(i)) shortSize++;
+ }
myIntToIntMap = PermanentListIntToIntMap.newInstance(myFlags, shortSize, 2);
}
diff --git a/platform/vcs-log/graph/test/com/intellij/vcs/log/graph/utils/UnsignedBitSetTest.java b/platform/vcs-log/graph/test/com/intellij/vcs/log/graph/utils/UnsignedBitSetTest.java
index f6cd2f1262c5..f04266f42d0d 100644
--- a/platform/vcs-log/graph/test/com/intellij/vcs/log/graph/utils/UnsignedBitSetTest.java
+++ b/platform/vcs-log/graph/test/com/intellij/vcs/log/graph/utils/UnsignedBitSetTest.java
@@ -18,17 +18,19 @@ package com.intellij.vcs.log.graph.utils;
import org.jetbrains.annotations.NotNull;
import org.junit.Test;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
public class UnsignedBitSetTest {
private static String toStr(@NotNull UnsignedBitSet bitSet) {
StringBuilder s = new StringBuilder();
for (int i = -5; i <= 5; i++) {
- if (bitSet.get(i))
+ if (bitSet.get(i)) {
s.append(1);
- else
+ }
+ else {
s.append(0);
+ }
}
return s.toString();
}
diff --git a/platform/vcs-log/graph/test/com/intellij/vcs/log/graph/utils/UpdatableIntToIntMapTest.java b/platform/vcs-log/graph/test/com/intellij/vcs/log/graph/utils/UpdatableIntToIntMapTest.java
index 7a4b25fb6518..e8634c27e70b 100644
--- a/platform/vcs-log/graph/test/com/intellij/vcs/log/graph/utils/UpdatableIntToIntMapTest.java
+++ b/platform/vcs-log/graph/test/com/intellij/vcs/log/graph/utils/UpdatableIntToIntMapTest.java
@@ -29,8 +29,7 @@ public abstract class UpdatableIntToIntMapTest {
private static Set parseSet(String visibility) {
Set visibleNodes = new HashSet();
- if (visibility.length() == 0)
- return visibleNodes;
+ if (visibility.length() == 0) return visibleNodes;
for (String number : visibility.split("\\|")) {
visibleNodes.add(Integer.decode(number));
@@ -38,7 +37,7 @@ public abstract class UpdatableIntToIntMapTest {
return visibleNodes;
}
-
+
private static class Tester {
private final Set myVisibleNodes;
@@ -61,8 +60,7 @@ public abstract class UpdatableIntToIntMapTest {
public String mapToString() {
StringBuilder s = new StringBuilder();
for (int shortIndex = 0; shortIndex < myUpdatableIntToIntMap.shortSize(); shortIndex++) {
- if (shortIndex != 0)
- s.append("|");
+ if (shortIndex != 0) s.append("|");
s.append(myUpdatableIntToIntMap.getLongIndex(shortIndex));
}
@@ -72,8 +70,7 @@ public abstract class UpdatableIntToIntMapTest {
public String reverseMapToString() {
StringBuilder s = new StringBuilder();
for (int longIndex = 0; longIndex < myUpdatableIntToIntMap.longSize(); longIndex++) {
- if (longIndex != 0)
- s.append("|");
+ if (longIndex != 0) s.append("|");
s.append(myUpdatableIntToIntMap.getShortIndex(longIndex));
}