From 1a666c10299793fdd34934191ecfc0df76fc4529 Mon Sep 17 00:00:00 2001 From: Craig Cornelius Date: Thu, 25 Feb 2021 22:51:55 +0000 Subject: [PATCH] ICU-21179 Remove unused code in Java break engines See #1604 --- .../core/src/com/ibm/icu/text/BurmeseBreakEngine.java | 8 ++------ .../core/src/com/ibm/icu/text/KhmerBreakEngine.java | 8 ++------ .../classes/core/src/com/ibm/icu/text/LaoBreakEngine.java | 8 ++------ .../core/src/com/ibm/icu/text/ThaiBreakEngine.java | 8 ++------ 4 files changed, 8 insertions(+), 24 deletions(-) diff --git a/icu4j/main/classes/core/src/com/ibm/icu/text/BurmeseBreakEngine.java b/icu4j/main/classes/core/src/com/ibm/icu/text/BurmeseBreakEngine.java index 1119ceed404..fe3d4f9f813 100644 --- a/icu4j/main/classes/core/src/com/ibm/icu/text/BurmeseBreakEngine.java +++ b/icu4j/main/classes/core/src/com/ibm/icu/text/BurmeseBreakEngine.java @@ -120,13 +120,9 @@ class BurmeseBreakEngine extends DictionaryBreakEngine { // If we're already at the end of the range, we're done if (fIter.getIndex() < rangeEnd) { do { - int wordsMatched = 1; if (words[(wordsFound+1)%BURMESE_LOOKAHEAD].candidates(fIter, fDictionary, rangeEnd) > 0) { - if (wordsMatched < 2) { - // Followed by another dictionary word; mark first word as a good candidate - words[wordsFound%BURMESE_LOOKAHEAD].markCurrent(); - wordsMatched = 2; - } + // Followed by another dictionary word; mark first word as a good candidate + words[wordsFound%BURMESE_LOOKAHEAD].markCurrent(); // If we're already at the end of the range, we're done if (fIter.getIndex() >= rangeEnd) { diff --git a/icu4j/main/classes/core/src/com/ibm/icu/text/KhmerBreakEngine.java b/icu4j/main/classes/core/src/com/ibm/icu/text/KhmerBreakEngine.java index 53b6872fbb2..b593c495b15 100644 --- a/icu4j/main/classes/core/src/com/ibm/icu/text/KhmerBreakEngine.java +++ b/icu4j/main/classes/core/src/com/ibm/icu/text/KhmerBreakEngine.java @@ -124,13 +124,9 @@ class KhmerBreakEngine extends DictionaryBreakEngine { // If we're already at the end of the range, we're done if (fIter.getIndex() < rangeEnd) { do { - int wordsMatched = 1; if (words[(wordsFound+1)%KHMER_LOOKAHEAD].candidates(fIter, fDictionary, rangeEnd) > 0) { - if (wordsMatched < 2) { - // Followed by another dictionary word; mark first word as a good candidate - words[wordsFound%KHMER_LOOKAHEAD].markCurrent(); - wordsMatched = 2; - } + // Followed by another dictionary word; mark first word as a good candidate + words[wordsFound%KHMER_LOOKAHEAD].markCurrent(); // If we're already at the end of the range, we're done if (fIter.getIndex() >= rangeEnd) { diff --git a/icu4j/main/classes/core/src/com/ibm/icu/text/LaoBreakEngine.java b/icu4j/main/classes/core/src/com/ibm/icu/text/LaoBreakEngine.java index 73d6a03ee39..ec1476026fe 100644 --- a/icu4j/main/classes/core/src/com/ibm/icu/text/LaoBreakEngine.java +++ b/icu4j/main/classes/core/src/com/ibm/icu/text/LaoBreakEngine.java @@ -123,13 +123,9 @@ class LaoBreakEngine extends DictionaryBreakEngine { // If we're already at the end of the range, we're done if (fIter.getIndex() < rangeEnd) { do { - int wordsMatched = 1; if (words[(wordsFound+1)%LAO_LOOKAHEAD].candidates(fIter, fDictionary, rangeEnd) > 0) { - if (wordsMatched < 2) { - // Followed by another dictionary word; mark first word as a good candidate - words[wordsFound%LAO_LOOKAHEAD].markCurrent(); - wordsMatched = 2; - } + // Followed by another dictionary word; mark first word as a good candidate + words[wordsFound%LAO_LOOKAHEAD].markCurrent(); // If we're already at the end of the range, we're done if (fIter.getIndex() >= rangeEnd) { diff --git a/icu4j/main/classes/core/src/com/ibm/icu/text/ThaiBreakEngine.java b/icu4j/main/classes/core/src/com/ibm/icu/text/ThaiBreakEngine.java index 89407397e09..c1579d6532e 100644 --- a/icu4j/main/classes/core/src/com/ibm/icu/text/ThaiBreakEngine.java +++ b/icu4j/main/classes/core/src/com/ibm/icu/text/ThaiBreakEngine.java @@ -134,13 +134,9 @@ class ThaiBreakEngine extends DictionaryBreakEngine { if (fIter.getIndex() < rangeEnd) { foundBest: do { - int wordsMatched = 1; if (words[(wordsFound+1)%THAI_LOOKAHEAD].candidates(fIter, fDictionary, rangeEnd) > 0) { - if (wordsMatched < 2) { - // Followed by another dictionary word; mark first word as a good candidate - words[wordsFound%THAI_LOOKAHEAD].markCurrent(); - wordsMatched = 2; - } + // Followed by another dictionary word; mark first word as a good candidate + words[wordsFound%THAI_LOOKAHEAD].markCurrent(); // If we're already at the end of the range, we're done if (fIter.getIndex() >= rangeEnd) {