From 45951b5013a843ac57c9a8654389fa29f7e38fd3 Mon Sep 17 00:00:00 2001 From: asofold Date: Sun, 2 Sep 2012 18:58:01 +0200 Subject: [PATCH] FlatWordBuckets: Ensure that at least as many entries as added get released. --- .../nocheatplus/checks/chat/analysis/FlatWordBuckets.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/fr/neatmonster/nocheatplus/checks/chat/analysis/FlatWordBuckets.java b/src/fr/neatmonster/nocheatplus/checks/chat/analysis/FlatWordBuckets.java index f9f15ff8..0576d871 100644 --- a/src/fr/neatmonster/nocheatplus/checks/chat/analysis/FlatWordBuckets.java +++ b/src/fr/neatmonster/nocheatplus/checks/chat/analysis/FlatWordBuckets.java @@ -15,6 +15,7 @@ public class FlatWordBuckets extends AbstractWordProcessor{ final long durBucket; final int nBuckets; final float factor; + public FlatWordBuckets(int maxSize, int nBuckets, long durBucket, float factor){ super("FlatWordBuckets"); this.maxSize = maxSize; @@ -27,12 +28,11 @@ public class FlatWordBuckets extends AbstractWordProcessor{ @Override public void start(MessageLetterCount message) { if (entries.size() + message.words.length > maxSize) - releaseMap(entries, maxSize / 10); + releaseMap(entries, Math.max(message.words.length, maxSize / 10)); } @Override - public float loop(long ts, int index, String key, - WordLetterCount message) { + public float loop(long ts, int index, String key, WordLetterCount word) { ActionFrequency freq = entries.get(key); if (freq == null){ freq = new ActionFrequency(nBuckets, durBucket);