diff --git a/platform/lang-impl/src/com/intellij/codeInsight/completion/StatisticsWeigher.java b/platform/lang-impl/src/com/intellij/codeInsight/completion/StatisticsWeigher.java index 54a09b2f195b..684f83aa8cb4 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/completion/StatisticsWeigher.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/completion/StatisticsWeigher.java @@ -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 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; } diff --git a/platform/platform-api/src/com/intellij/psi/statistics/StatisticsInfo.java b/platform/platform-api/src/com/intellij/psi/statistics/StatisticsInfo.java index 1a54aa5b0961..f22660671fcf 100644 --- a/platform/platform-api/src/com/intellij/psi/statistics/StatisticsInfo.java +++ b/platform/platform-api/src/com/intellij/psi/statistics/StatisticsInfo.java @@ -21,7 +21,7 @@ import org.jetbrains.annotations.NotNull; /** * @author peter */ -public class StatisticsInfo implements Comparable{ +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{ 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{ return ourManager.getUseCount(this); } + public int getLastUseRecency() { + return ourManager.getLastUseRecency(this); + } + public String toString() { return myContext + "::::" + myValue; }