From c34f0ecd83e485579059561a3e5b615c9fdd0dea Mon Sep 17 00:00:00 2001 From: George Rhoten Date: Sat, 30 Sep 2006 00:37:45 +0000 Subject: [PATCH] ICU-5426 Compact cached UnicodeSets, and make setCharacters take a const UnicodeSet. X-SVN-Rev: 20460 --- icu4c/source/common/dictbe.cpp | 10 +++++++++- icu4c/source/common/dictbe.h | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/icu4c/source/common/dictbe.cpp b/icu4c/source/common/dictbe.cpp index ac774f7c765..1ff74e00562 100644 --- a/icu4c/source/common/dictbe.cpp +++ b/icu4c/source/common/dictbe.cpp @@ -81,8 +81,10 @@ DictionaryBreakEngine::findBreaks( UText *text, } void -DictionaryBreakEngine::setCharacters( UnicodeSet &set ) { +DictionaryBreakEngine::setCharacters( const UnicodeSet &set ) { fSet = set; + // Compact for caching + fSet.compact(); } /*void @@ -225,6 +227,12 @@ ThaiBreakEngine::ThaiBreakEngine(const TrieWordDictionary *adoptDictionary, UErr fBeginWordSet.add(0x0E40, 0x0E44); // SARA E through SARA AI MAIMALAI fSuffixSet.add(THAI_PAIYANNOI); fSuffixSet.add(THAI_MAIYAMOK); + + // Compact for caching. + fMarkSet.compact(); + fEndWordSet.compact(); + fBeginWordSet.compact(); + fSuffixSet.compact(); } ThaiBreakEngine::~ThaiBreakEngine() { diff --git a/icu4c/source/common/dictbe.h b/icu4c/source/common/dictbe.h index 80a52f57e16..d6f8b1462d2 100644 --- a/icu4c/source/common/dictbe.h +++ b/icu4c/source/common/dictbe.h @@ -104,7 +104,7 @@ class DictionaryBreakEngine : public LanguageBreakEngine { * * @param set A UnicodeSet of the set of characters handled by the engine */ - virtual void setCharacters( UnicodeSet &set ); + virtual void setCharacters( const UnicodeSet &set ); /** *

Set the break types handled by this engine.