mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
minor refactoring
This commit is contained in:
+1
-1
@@ -32,7 +32,7 @@ public class IndentOptionsDetector {
|
||||
|
||||
private static final double RATE_THRESHOLD = 0.8;
|
||||
private static final int MIN_LINES_THRESHOLD = 50;
|
||||
private static int MAX_INDENT_TO_DETECT = 8;
|
||||
private static final int MAX_INDENT_TO_DETECT = 8;
|
||||
|
||||
private final PsiFile myFile;
|
||||
private final Project myProject;
|
||||
|
||||
+6
-6
@@ -40,14 +40,14 @@ public class IndentUsageStatisticsImpl implements IndentUsageStatistics {
|
||||
private int myTotalLinesWithTabs = 0;
|
||||
private int myTotalLinesWithWhiteSpaces = 0;
|
||||
|
||||
private TIntIntHashMap myIndentToUsages = new TIntIntHashMap();
|
||||
private TIntIntHashMap myIndentToUsagesMap = new TIntIntHashMap();
|
||||
private List<IndentUsageInfo> myIndentUsages = ContainerUtil.newArrayList();
|
||||
private Stack<IndentData> myParentIndents = ContainerUtil.newStack(new IndentData(0, 0));
|
||||
|
||||
public IndentUsageStatisticsImpl(@NotNull List<LineIndentInfo> lineInfos) {
|
||||
myLineInfos = lineInfos;
|
||||
buildIndentToUsagesMap();
|
||||
myIndentUsages = toIndentUsageList(myIndentToUsages);
|
||||
myIndentUsages = toIndentUsageList(myIndentToUsagesMap);
|
||||
ContainerUtil.sort(myIndentUsages, DECREASING_ORDER);
|
||||
}
|
||||
|
||||
@@ -108,8 +108,8 @@ public class IndentUsageStatisticsImpl implements IndentUsageStatistics {
|
||||
}
|
||||
|
||||
private void increaseIndentUsage(int relativeIndent) {
|
||||
int timesUsed = myIndentToUsages.get(relativeIndent);
|
||||
myIndentToUsages.put(relativeIndent, ++timesUsed);
|
||||
int timesUsed = myIndentToUsagesMap.get(relativeIndent);
|
||||
myIndentToUsagesMap.put(relativeIndent, ++timesUsed);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -129,12 +129,12 @@ public class IndentUsageStatisticsImpl implements IndentUsageStatistics {
|
||||
|
||||
@Override
|
||||
public int getTimesIndentUsed(int indent) {
|
||||
return myIndentToUsages.get(indent);
|
||||
return myIndentToUsagesMap.get(indent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTotalIndentSizesDetected() {
|
||||
return myIndentToUsages.size();
|
||||
return myIndentToUsagesMap.size();
|
||||
}
|
||||
|
||||
private static class IndentData {
|
||||
|
||||
@@ -18,9 +18,9 @@ package com.intellij.psi.codeStyle.autodetect;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class LineIndentInfo {
|
||||
public static LineIndentInfo EMPTY_LINE = new LineIndentInfo(LineType.EMPTY_LINE, -1);
|
||||
public static LineIndentInfo LINE_WITH_COMMENT = new LineIndentInfo(LineType.LINE_WITH_COMMENT, -1);
|
||||
public static LineIndentInfo LINE_WITH_TABS = new LineIndentInfo(LineType.LINE_WITH_TABS, -1);
|
||||
public static final LineIndentInfo EMPTY_LINE = new LineIndentInfo(LineType.EMPTY_LINE, -1);
|
||||
public static final LineIndentInfo LINE_WITH_COMMENT = new LineIndentInfo(LineType.LINE_WITH_COMMENT, -1);
|
||||
public static final LineIndentInfo LINE_WITH_TABS = new LineIndentInfo(LineType.LINE_WITH_TABS, -1);
|
||||
|
||||
private final int myIndentSize;
|
||||
private final LineType myType;
|
||||
|
||||
Reference in New Issue
Block a user