From 7467a2cb5baf2df2bd8f80b0bf952b18cfcf986a Mon Sep 17 00:00:00 2001 From: vsxd Date: Tue, 14 Jan 2025 10:02:27 +0800 Subject: [PATCH] Revert "rename local var" This reverts commit c0090f7678704d67f4f022fb4b009ac0e2d8c460. --- hutool-dfa/src/main/java/cn/hutool/dfa/WordTree.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hutool-dfa/src/main/java/cn/hutool/dfa/WordTree.java b/hutool-dfa/src/main/java/cn/hutool/dfa/WordTree.java index fa193ddad..b52133be7 100755 --- a/hutool-dfa/src/main/java/cn/hutool/dfa/WordTree.java +++ b/hutool-dfa/src/main/java/cn/hutool/dfa/WordTree.java @@ -98,7 +98,7 @@ public class WordTree extends HashMap { * @return this */ public WordTree addWord(String word) { - final Filter localCharFilter = this.charFilter; + final Filter charFilter = this.charFilter; WordTree parent = null; WordTree current = this; WordTree child; @@ -106,7 +106,7 @@ public class WordTree extends HashMap { final int length = word.length(); for (int i = 0; i < length; i++) { currentChar = word.charAt(i); - if (localCharFilter.accept(currentChar)) {//只处理合法字符 + if (charFilter.accept(currentChar)) {//只处理合法字符 child = current.get(currentChar); if (child == null) { //无子类,新建一个子节点后存放下一个字符 @@ -245,7 +245,7 @@ public class WordTree extends HashMap { List foundWords = new ArrayList<>(); WordTree current = this; final int length = text.length(); - final Filter localCharFilter = this.charFilter; + final Filter charFilter = this.charFilter; //存放查找到的字符缓存。完整出现一个词时加到findedWords中,否则清空 final StringBuilder wordBuffer = StrUtil.builder(); final StringBuilder keyBuffer = StrUtil.builder(); @@ -256,7 +256,7 @@ public class WordTree extends HashMap { for (int j = i; j < length; j++) { currentChar = text.charAt(j); // Console.log("i: {}, j: {}, currentChar: {}", i, j, currentChar); - if (false == localCharFilter.accept(currentChar)) { + if (false == charFilter.accept(currentChar)) { if (wordBuffer.length() > 0) { //做为关键词中间的停顿词被当作关键词的一部分被返回 wordBuffer.append(currentChar);