src/share/classes/java/text/RBTableBuilder.java

Print this page




  54  * during the build process, plus a "shadow" copy of all of the state
  55  * that will go into the tables object itself.  This object communicates
  56  * with RBCollationTables through a separate class, RBCollationTables.BuildAPI,
  57  * this is an inner class of RBCollationTables and provides a separate
  58  * private API for communication with RBTableBuilder.
  59  * This class isn't just an inner class of RBCollationTables itself because
  60  * of its large size.  For source-code readability, it seemed better for the
  61  * builder to have its own source file.
  62  */
  63 final class RBTableBuilder {
  64 
  65     public RBTableBuilder(RBCollationTables.BuildAPI tables) {
  66         this.tables = tables;
  67     }
  68 
  69     /**
  70      * Create a table-based collation object with the given rules.
  71      * This is the main function that actually builds the tables and
  72      * stores them back in the RBCollationTables object.  It is called
  73      * ONLY by the RBCollationTables constructor.
  74      * @see java.util.RuleBasedCollator#RuleBasedCollator
  75      * @exception ParseException If the rules format is incorrect.
  76      */
  77 
  78     public void build(String pattern, int decmp) throws ParseException
  79     {
  80         boolean isSource = true;
  81         int i = 0;
  82         String expChars;
  83         String groupChars;
  84         if (pattern.length() == 0)
  85             throw new ParseException("Build rules empty.", 0);
  86 
  87         // This array maps Unicode characters to their collation ordering
  88         mapping = new UCompactIntArray(RBCollationTables.UNMAPPED);
  89         // Normalize the build rules.  Find occurances of all decomposed characters
  90         // and normalize the rules before feeding into the builder.  By "normalize",
  91         // we mean that all precomposed Unicode characters must be converted into
  92         // a base character and one or more combining characters (such as accents).
  93         // When there are multiple combining characters attached to a base character,
  94         // the combining characters must be in their canonical order




  54  * during the build process, plus a "shadow" copy of all of the state
  55  * that will go into the tables object itself.  This object communicates
  56  * with RBCollationTables through a separate class, RBCollationTables.BuildAPI,
  57  * this is an inner class of RBCollationTables and provides a separate
  58  * private API for communication with RBTableBuilder.
  59  * This class isn't just an inner class of RBCollationTables itself because
  60  * of its large size.  For source-code readability, it seemed better for the
  61  * builder to have its own source file.
  62  */
  63 final class RBTableBuilder {
  64 
  65     public RBTableBuilder(RBCollationTables.BuildAPI tables) {
  66         this.tables = tables;
  67     }
  68 
  69     /**
  70      * Create a table-based collation object with the given rules.
  71      * This is the main function that actually builds the tables and
  72      * stores them back in the RBCollationTables object.  It is called
  73      * ONLY by the RBCollationTables constructor.
  74      * @see RuleBasedCollator#RuleBasedCollator
  75      * @exception ParseException If the rules format is incorrect.
  76      */
  77 
  78     public void build(String pattern, int decmp) throws ParseException
  79     {
  80         boolean isSource = true;
  81         int i = 0;
  82         String expChars;
  83         String groupChars;
  84         if (pattern.length() == 0)
  85             throw new ParseException("Build rules empty.", 0);
  86 
  87         // This array maps Unicode characters to their collation ordering
  88         mapping = new UCompactIntArray(RBCollationTables.UNMAPPED);
  89         // Normalize the build rules.  Find occurances of all decomposed characters
  90         // and normalize the rules before feeding into the builder.  By "normalize",
  91         // we mean that all precomposed Unicode characters must be converted into
  92         // a base character and one or more combining characters (such as accents).
  93         // When there are multiple combining characters attached to a base character,
  94         // the combining characters must be in their canonical order