mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
cleanup StatisticsInfo
This commit is contained in:
@@ -38,7 +38,6 @@ import java.util.*;
|
||||
* @author peter
|
||||
*/
|
||||
public class StatisticsWeigher extends CompletionWeigher {
|
||||
private static final StatisticsManager ourStatManager = StatisticsManager.getInstance();
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.codeInsight.completion.StatisticsWeigher.LookupStatisticsWeigher");
|
||||
private static final Key<StatisticsInfo> BASE_STATISTICS_INFO = Key.create("Base statistics info");
|
||||
|
||||
@@ -149,8 +148,8 @@ public class StatisticsWeigher extends CompletionWeigher {
|
||||
int minRecency = Integer.MAX_VALUE;
|
||||
int maxUseCount = 0;
|
||||
for (StatisticsInfo eachInfo : composeStatsWithPrefix(baseInfo, prefix, false)) {
|
||||
minRecency = Math.min(minRecency, ourStatManager.getLastUseRecency(eachInfo));
|
||||
maxUseCount = Math.max(maxUseCount, ourStatManager.getUseCount(eachInfo));
|
||||
minRecency = Math.min(minRecency, eachInfo.getLastUseRecency());
|
||||
maxUseCount = Math.max(maxUseCount, eachInfo.getUseCount());
|
||||
}
|
||||
return minRecency == Integer.MAX_VALUE ? maxUseCount : 100 - minRecency;
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
/**
|
||||
* @author peter
|
||||
*/
|
||||
public class StatisticsInfo implements Comparable<StatisticsInfo>{
|
||||
public class StatisticsInfo {
|
||||
public static final StatisticsInfo EMPTY = new StatisticsInfo("empty", "empty");
|
||||
|
||||
private static final StatisticsManager ourManager = StatisticsManager.getInstance();
|
||||
@@ -43,10 +43,6 @@ public class StatisticsInfo implements Comparable<StatisticsInfo>{
|
||||
return myValue;
|
||||
}
|
||||
|
||||
public int compareTo(final StatisticsInfo o) {
|
||||
return getUseCount() - o.getUseCount();
|
||||
}
|
||||
|
||||
public void incUseCount() {
|
||||
ourManager.incUseCount(this);
|
||||
}
|
||||
@@ -55,6 +51,10 @@ public class StatisticsInfo implements Comparable<StatisticsInfo>{
|
||||
return ourManager.getUseCount(this);
|
||||
}
|
||||
|
||||
public int getLastUseRecency() {
|
||||
return ourManager.getLastUseRecency(this);
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return myContext + "::::" + myValue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user