Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

dbbi_bld.h

Go to the documentation of this file.
00001 
00006 protected class Builder extends RuleBasedBreakIterator.Builder {
00007 
00011     private CharSet dictionaryChars = new CharSet();
00012     private String dictionaryExpression = "";
00013 
00017     public Builder() {
00018     }
00019 
00026     protected void handleSpecialSubstitution(String replace, String replaceWith,
00027                                              int startPos, String description) {
00028         super.handleSpecialSubstitution(replace, replaceWith, startPos, description);
00029 
00030         if (replace.equals("<dictionary>")) {
00031             if (replaceWith.charAt(0) == '(') {
00032                 error("Dictionary group can't be enclosed in (", startPos, description);
00033             }
00034             dictionaryExpression = replaceWith;
00035             dictionaryChars = CharSet.parseString(replaceWith);
00036         }
00037     }
00038 
00045     protected void buildCharCategories(Vector tempRuleList) {
00046         super.buildCharCategories(tempRuleList);
00047 
00048         categoryFlags = new boolean[categories.size()];
00049         for (int i = 0; i < categories.size(); i++) {
00050             CharSet cs = (CharSet)categories.elementAt(i);
00051             if (!(cs.intersection(dictionaryChars).empty())) {
00052                 categoryFlags[i] = true;
00053             }
00054         }
00055     }
00056 
00057     // This function is actually called by RuleBasedBreakIterator.buildCharCategories(),
00058     // which is called by the function above.  This gives us a way to create a separate
00059     // character category for the dictionary characters even when RuleBasedBreakIterator
00060     // isn't making a distinction
00061     protected void mungeExpressionList(Hashtable expressions) {
00062         expressions.put(dictionaryExpression, dictionaryChars);
00063     }
00064 }

Generated at Tue Dec 5 17:55:26 2000 for ICU by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000