[vcs-log] minor: convert anonimous to inner

This commit is contained in:
Julia Beliaeva
2016-08-29 20:42:41 +03:00
parent 96077ea349
commit a2da2d2e8a
@@ -24,7 +24,6 @@ import com.intellij.vcs.log.graph.api.elements.GraphEdgeType;
import com.intellij.vcs.log.graph.api.elements.GraphElement;
import com.intellij.vcs.log.graph.api.elements.GraphNodeType;
import com.intellij.vcs.log.graph.api.permanent.PermanentGraphInfo;
import com.intellij.vcs.log.graph.api.printer.PrintElementGenerator;
import com.intellij.vcs.log.graph.impl.facade.LinearGraphController.LinearGraphAction;
import com.intellij.vcs.log.graph.impl.print.PrintElementGeneratorImpl;
import com.intellij.vcs.log.graph.impl.print.elements.PrintElementWithGraphElement;
@@ -65,40 +64,7 @@ public class VisibleGraphImpl<CommitId> implements VisibleGraph<CommitId> {
public RowInfo<CommitId> getRowInfo(final int visibleRow) {
final int nodeId = myGraphController.getCompiledGraph().getNodeId(visibleRow);
assert nodeId >= 0; // todo remake for all id
return new RowInfo<CommitId>() {
@NotNull
@Override
public CommitId getCommit() {
return myPermanentGraph.getPermanentCommitsInfo().getCommitId(nodeId);
}
@NotNull
@Override
public CommitId getOneOfHeads() {
int headNodeId = myPermanentGraph.getPermanentGraphLayout().getOneOfHeadNodeIndex(nodeId);
return myPermanentGraph.getPermanentCommitsInfo().getCommitId(headNodeId);
}
@NotNull
@Override
public Collection<? extends PrintElement> getPrintElements() {
return myPrintElementGenerator.getPrintElements(visibleRow);
}
@NotNull
@Override
public RowType getRowType() {
GraphNodeType nodeType = myGraphController.getCompiledGraph().getGraphNode(visibleRow).getType();
switch (nodeType) {
case USUAL:
return RowType.NORMAL;
case UNMATCHED:
return RowType.UNMATCHED;
default:
throw new UnsupportedOperationException("Unsupported node type: " + nodeType);
}
}
};
return new MyRowInfo(nodeId, visibleRow);
}
@Override
@@ -284,4 +250,47 @@ public class VisibleGraphImpl<CommitId> implements VisibleGraph<CommitId> {
return myType;
}
}
private class MyRowInfo implements RowInfo<CommitId> {
private final int myNodeId;
private final int myVisibleRow;
public MyRowInfo(int nodeId, int visibleRow) {
myNodeId = nodeId;
myVisibleRow = visibleRow;
}
@NotNull
@Override
public CommitId getCommit() {
return myPermanentGraph.getPermanentCommitsInfo().getCommitId(myNodeId);
}
@NotNull
@Override
public CommitId getOneOfHeads() {
int headNodeId = myPermanentGraph.getPermanentGraphLayout().getOneOfHeadNodeIndex(myNodeId);
return myPermanentGraph.getPermanentCommitsInfo().getCommitId(headNodeId);
}
@NotNull
@Override
public Collection<? extends PrintElement> getPrintElements() {
return myPrintElementGenerator.getPrintElements(myVisibleRow);
}
@NotNull
@Override
public RowType getRowType() {
GraphNodeType nodeType = myGraphController.getCompiledGraph().getGraphNode(myVisibleRow).getType();
switch (nodeType) {
case USUAL:
return RowType.NORMAL;
case UNMATCHED:
return RowType.UNMATCHED;
default:
throw new UnsupportedOperationException("Unsupported node type: " + nodeType);
}
}
}
}