From 161548cbff21c29043cc231a77423eadf93d18e1 Mon Sep 17 00:00:00 2001 From: asofold Date: Tue, 4 Sep 2012 09:08:19 +0200 Subject: [PATCH] Fix CompressedChars filling up indefinitely, monitor exact node number. --- .../checks/chat/analysis/engine/CompressedChars.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/fr/neatmonster/nocheatplus/checks/chat/analysis/engine/CompressedChars.java b/src/fr/neatmonster/nocheatplus/checks/chat/analysis/engine/CompressedChars.java index ec03420b..13671255 100644 --- a/src/fr/neatmonster/nocheatplus/checks/chat/analysis/engine/CompressedChars.java +++ b/src/fr/neatmonster/nocheatplus/checks/chat/analysis/engine/CompressedChars.java @@ -27,7 +27,11 @@ public class CompressedChars extends AbstractWordProcessor{ @Override public void start(MessageLetterCount message) { - if (added + message.words.length > maxAdd) tree.clear(); + // This allows adding up to maximum messge length more characters, + // but also allows to set size of nodes exactly. + // TODO: Some better method than blunt clear (extra LinkedHashSet/LRU?). + if (added > maxAdd) tree.clear(); + added = 0; } @Override @@ -70,6 +74,7 @@ public class CompressedChars extends AbstractWordProcessor{ score += 0.2; if (entry.insertion.isEnd) score += 0.2; } + if (len != entry.depth) added += len - entry.depth; return score; }