home *** CD-ROM | disk | FTP | other *** search
/ Chip 1998 November / Chip_1998-11_cd.bin / tema / Cafe / main.bin / CharacterBreakData.java < prev    next >
Text File  |  1997-05-20  |  8KB  |  181 lines

  1. /*
  2.  * @(#)CharacterBreakData.java    1.5 97/01/17
  3.  *
  4.  * (C) Copyright Taligent, Inc. 1996 - All Rights Reserved
  5.  * (C) Copyright IBM Corp. 1996 - All Rights Reserved
  6.  *
  7.  * Portions copyright (c) 1996 Sun Microsystems, Inc. All Rights Reserved.
  8.  *
  9.  *   The original version of this source code and documentation is copyrighted
  10.  * and owned by Taligent, Inc., a wholly-owned subsidiary of IBM. These
  11.  * materials are provided under terms of a License Agreement between Taligent
  12.  * and Sun. This technology is protected by multiple US and International
  13.  * patents. This notice and attribution to Taligent may not be removed.
  14.  *   Taligent is a registered trademark of Taligent, Inc.
  15.  *
  16.  * Permission to use, copy, modify, and distribute this software
  17.  * and its documentation for NON-COMMERCIAL purposes and without
  18.  * fee is hereby granted provided that this copyright notice
  19.  * appears in all copies. Please refer to the file "copyright.html"
  20.  * for further important copyright and licensing information.
  21.  *
  22.  * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF
  23.  * THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
  24.  * TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
  25.  * PARTICULAR PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR
  26.  * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
  27.  * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
  28.  *
  29.  */
  30.  
  31. package java.text;
  32.  
  33. /**
  34.  * The CharacterBreakData contains data used by SimpleTextBoundary
  35.  * to determine character breaks.
  36.  * @see #BreakIterator
  37.  */
  38. final class CharacterBreakData extends TextBoundaryData
  39. {
  40.     private static final byte accent_diacritic = 0;
  41.     private static final byte baseForm = 1;
  42.     private static final int COL_COUNT = 2;
  43.     private static final byte SI = (byte)0x80;
  44.     private static final byte kCharacterForwardData[] =
  45.     {
  46.         //    acct            base
  47.         (byte)(     0), (byte)(     0),
  48.         (byte)(0x80+2), (byte)(0x80+2),
  49.         (byte)(0x80+2), (byte)(0x80+0)
  50.     };
  51.     private static final WordBreakTable kCharacterForwardTable =
  52.     new WordBreakTable(COL_COUNT, kCharacterForwardData);
  53.     private static final byte kCharacterBackwardData[] =
  54.     {
  55.         (byte)(     0), (byte)(     0),
  56.         (byte)(0x80+1), (byte)(0x80+0)
  57.     };
  58.     private static final WordBreakTable kCharacterBackwardTable =
  59.     new WordBreakTable(COL_COUNT, kCharacterBackwardData);
  60.     private static final int kRawMapping[] =
  61.     {
  62.         baseForm, //UNASSIGNED        = 0,
  63.         baseForm, //UPPERCASE_LETTER    = 1,
  64.         baseForm, //LOWERCASE_LETTER    = 2,
  65.         baseForm, //TITLECASE_LETTER    = 3,
  66.         baseForm, //MODIFIER_LETTER        = 4,
  67.         baseForm, //OTHER_LETTER        = 5,
  68.         accent_diacritic, //NON_SPACING_MARK    = 6,
  69.         accent_diacritic, //ENCLOSING_MARK        = 7,
  70.         baseForm, //COMBINING_SPACING_MARK    = 8,
  71.         baseForm, //DECIMAL_DIGIT_NUMBER    = 9,
  72.         baseForm, //LETTER_NUMBER        = 10,
  73.         baseForm, //OTHER_NUMBER        = 11,
  74.         baseForm, //SPACE_SEPARATOR        = 12,
  75.         baseForm, //LINE_SEPARATOR        = 13,
  76.         baseForm, //PARAGRAPH_SEPARATOR    = 14,
  77.         baseForm, //CONTROL            = 15,
  78.         baseForm, //FORMAT        = 16,
  79.         baseForm, //????            = 17,
  80.         baseForm, //PRIVATE_USE        = 18,
  81.         baseForm, //SURROGATE        = 19,
  82.         baseForm, //DASH_PUNCTUATION    = 20,
  83.         baseForm, //START_PUNCTUATION    = 21,
  84.         baseForm, //END_PUNCTUATION        = 22,
  85.         baseForm, //CONNECTOR_PUNCTUATION    = 23,
  86.         baseForm, //OTHER_PUNCTUATION    = 24,
  87.         baseForm, //MATH_SYMBOL        = 25,
  88.         baseForm, //CURRENCY_SYMBOL        = 26,
  89.         baseForm, //MODIFIER_SYMBOL        = 27,
  90.         baseForm, //OTHER_SYMBOL        = 28;
  91.     };
  92.     /*
  93.     private static final int kRawMapping[] =
  94.     {
  95.         baseForm, //00   Invalid
  96.         baseForm, //01   SpaceWhitespace
  97.         baseForm, //02   ZerowidthSpaceWhitespace
  98.         baseForm, //03   ISOcontrol
  99.         baseForm, //04   WhitespaceISOcontrol
  100.         baseForm, //05   Dash
  101.         baseForm, //06   Punctuation
  102.         baseForm, //07   DashPunctuation
  103.         baseForm, //08   HyphenPunctuation
  104.         baseForm, //09   DashHyphenPunctuation
  105.         baseForm, //10   PunctuationQuotationmark
  106.         baseForm, //11   PunctuationTerminalpunctuation
  107.         baseForm, //12   Currencysymbol
  108.         baseForm, //13   PunctuationPairedpunctuation
  109.         baseForm, //14   PunctuationQuotationmarkPairedpunctuation
  110.         baseForm, //15   PunctuationPairedpunctuationLeftofpair
  111.         baseForm, //16   PunctuationQuotationmarkPairedpunctuationLeftofpair
  112.         baseForm, //17   PunctuationPairedpunctuationCombining
  113.         baseForm, //18   PunctuationPairedpunctuationLeftofpairCombining
  114.         baseForm, //19   Composite
  115.         baseForm, //20   Numeric
  116.         baseForm, //21   CompositeNumeric
  117.         baseForm, //22   PunctuationAlphabetic
  118.         baseForm, //23   Diacritic
  119.         baseForm, //24   CompositeDiacritic
  120.         baseForm, //25   PunctuationIdentifierpart
  121.         baseForm, //26   DecimaldigitNumericIdentifierpart
  122.         baseForm, //27   HexdigitDecimaldigitNumericIdentifierpart
  123.         baseForm, //28   AlphabeticIdentifierpart
  124.         baseForm, //29   CombiningAlphabeticIdentifierpart
  125.         baseForm, //30   CompositeAlphabeticIdentifierpart
  126.         baseForm, //31   CombiningCompositeAlphabeticIdentifierpart
  127.         baseForm, //32   NumericAlphabeticIdentifierpart
  128.         baseForm, //33   CompositeNumericAlphabeticIdentifierpart
  129.         baseForm, //34   IdeographicIdentifierpart
  130.         baseForm, //35   NumericIdeographicIdentifierpart
  131.         baseForm, //36   CombiningDiacriticIdentifierpart
  132.         baseForm, //37   ExtenderIdentifierpart
  133.         baseForm, //38   CompositeExtenderIdentifierpart
  134.         baseForm, //39   DiacriticExtenderIdentifierpart
  135.         baseForm, //40   PunctuationDiacriticExtenderIdentifierpart
  136.         baseForm, //41   ZerowidthWhitespaceBidicontrolIgnorablecontrol
  137.         baseForm, //42   ZerowidthWhitespaceJoincontrolIgnorablecontrol
  138.         baseForm, //43   ZerowidthWhitespaceFormatcontrolIgnorablecontrol
  139.         baseForm, //44   AlphabeticIdentifierpartLower
  140.         baseForm, //45   CompositeAlphabeticIdentifierpartLower
  141.         baseForm, //46   HexdigitAlphabeticIdentifierpartLower
  142.         baseForm, //47   AlphabeticIdentifierpartUpper
  143.         baseForm, //48   CompositeAlphabeticIdentifierpartUpper
  144.         baseForm, //49   HexdigitAlphabeticIdentifierpartUpper
  145.         baseForm, //50   CompositeAlphabeticIdentifierpartTitle
  146.         accent_diacritic, //51   Marknonspacing
  147.         accent_diacritic, //52   CombiningMarknonspacing
  148.         accent_diacritic, //53   CombiningIdentifierpartMarknonspacing
  149.         accent_diacritic, //54   AlphabeticIdentifierpartMarknonspacing
  150.         accent_diacritic, //55 CombiningAlphabeticIdentifierpartMarknonspacing
  151.         accent_diacritic, //56 CompositeAlphabeticIdentifierpartMarknonspacing
  152.         accent_diacritic, //57 CombiningCompositeAlphabeticIdentifierpartMarknonspacing
  153.         accent_diacritic, //58 CombiningDiacriticIdentifierpartMarknonspacing
  154.         accent_diacritic, //59 CombiningCompositeDiacriticIdentifierpartMarknonspacing
  155.         baseForm, //60 WhitespaceNongraphicSeparator
  156.         baseForm, //61 WhitespaceISOcontrolNongraphicSeparator
  157.         baseForm, //62 SpaceWhitespaceNongraphicNobreak
  158.         baseForm, //63 ZerowidthSpaceWhitespaceIgnorablecontrolNongraphicNobreak
  159.     };*/
  160.  
  161.     private static final SpecialMapping kExceptionChar[] = {};
  162.     private static final UnicodeClassMapping kCharacterMap
  163.         = new UnicodeClassMapping(kRawMapping, kExceptionChar);
  164.  
  165.     public WordBreakTable forward()
  166.     {
  167.         return kCharacterForwardTable;
  168.     }
  169.  
  170.     public WordBreakTable backward()
  171.     {
  172.         return kCharacterBackwardTable;
  173.     }
  174.  
  175.     public UnicodeClassMapping map()
  176.     {
  177.         return kCharacterMap;
  178.     }
  179. }
  180.  
  181.