View Javadoc

1   /*
2   Copyright (c) 2008 Health Market Science, Inc.
3   
4   This library is free software; you can redistribute it and/or
5   modify it under the terms of the GNU Lesser General Public
6   License as published by the Free Software Foundation; either
7   version 2.1 of the License, or (at your option) any later version.
8   
9   This library is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  Lesser General Public License for more details.
13  
14  You should have received a copy of the GNU Lesser General Public
15  License along with this library; if not, write to the Free Software
16  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
17  USA
18  
19  You can contact Health Market Science at info@healthmarketscience.com
20  or at the following address:
21  
22  Health Market Science
23  2700 Horizon Drive
24  Suite 200
25  King of Prussia, PA 19406
26  */
27  
28  package com.healthmarketscience.jackcess;
29  
30  import java.util.HashMap;
31  import java.util.Map;
32  
33  /**
34   * Various constants used for creating index entries.
35   *
36   * @author James Ahlborn
37   */
38  public class IndexCodes {
39  
40    static final byte ASC_START_FLAG = (byte)0x7F;
41    static final byte ASC_NULL_FLAG = (byte)0x00;
42    static final byte DESC_START_FLAG = (byte)0x80;
43    static final byte DESC_NULL_FLAG = (byte)0xFF;
44  
45    static final byte END_TEXT = (byte)0x01;
46  
47    static final byte END_EXTRA_TEXT = (byte)0x00;
48  
49    static final byte ASC_BOOLEAN_TRUE = (byte)0x00;
50    static final byte ASC_BOOLEAN_FALSE = (byte)0xFF;
51    
52    static final byte DESC_BOOLEAN_TRUE = ASC_BOOLEAN_FALSE;
53    static final byte DESC_BOOLEAN_FALSE = ASC_BOOLEAN_TRUE;
54    
55  
56    // unprintable char is removed from normal text.
57    // pattern for unprintable chars in the extra bytes:
58    // 01 01 01 <pos> 06  <code> )
59    // <pos> = 7 + (4 * char_pos) | 0x8000 (as short)
60    // <code> = char code
61    static final int UNPRINTABLE_COUNT_START = 7;
62    static final int UNPRINTABLE_COUNT_MULTIPLIER = 4;
63    static final byte[] UNPRINTABLE_COMMON_PREFIX =
64      new byte[]{(byte)0x01, (byte)0x01, (byte)0x01};
65    static final int UNPRINTABLE_OFFSET_FLAGS = 0x8000;
66    static final byte UNPRINTABLE_MIDFIX = (byte)0x06;
67  
68    // international char is replaced with ascii char.
69    // pattern for international chars in the extra bytes:
70    // [ 02 (for each normal char) ] [ <symbol_code> (for each inat char) ]
71    static final byte INTERNATIONAL_EXTRA_PLACEHOLDER = (byte)0x02;
72    
73    /**
74     * Map of character to byte[] that Access uses in indexes (not ASCII)
75     * (Character -> byte[]) as codes to order text
76     */
77    static final Map<Character, byte[]> CODES =
78      new HashMap<Character, byte[]>(150);
79  
80    /**
81     * Map of character to byte[] that Access uses in indexes for unprintable
82     * characters (not ASCII) (Character -> byte[]), in the extended portion
83     */
84    static final Map<Character, byte[]> UNPRINTABLE_CODES =
85      new HashMap<Character, byte[]>(100);
86    
87    /**
88     * Map of character to byte[] that Access uses in indexes for international
89     * characters (not ASCII) (Character -> InternationalCodes), in the extended
90     * portion
91     */
92    static final Map<Character, InternationalCodes> INTERNATIONAL_CODES =
93      new HashMap<Character, InternationalCodes>(70);
94    
95    static {
96      
97      registerCodes('\u0000', new byte[]{});
98      registerCodes('\t',     new byte[]{(byte)0x08, (byte)0x03});
99      registerCodes('\n',     new byte[]{(byte)0x08, (byte)0x04});
100     registerCodes('\u000B', new byte[]{(byte)0x08, (byte)0x05});
101     registerCodes('\f',     new byte[]{(byte)0x08, (byte)0x06});
102     registerCodes('\r',     new byte[]{(byte)0x08, (byte)0x07});
103     registerCodes('\u0020', new byte[]{(byte)0x07});
104     registerCodes('\u0021', new byte[]{(byte)0x09});
105     registerCodes('\"',     new byte[]{(byte)0x0A});
106     registerCodes('\u0023', new byte[]{(byte)0x0C});
107     registerCodes('\u0024', new byte[]{(byte)0x0E});
108     registerCodes('\u0025', new byte[]{(byte)0x10});
109     registerCodes('\u0026', new byte[]{(byte)0x12});
110     registerCodes('\u0028', new byte[]{(byte)0x14});
111     registerCodes('\u0029', new byte[]{(byte)0x16});
112     registerCodes('\u002A', new byte[]{(byte)0x18});
113     registerCodes('\u002B', new byte[]{(byte)0x2C});
114     registerCodes('\u002C', new byte[]{(byte)0x1A});
115     registerCodes('\u002E', new byte[]{(byte)0x1C});
116     registerCodes('\u002F', new byte[]{(byte)0x1E});
117     registerCodes('\u0030', new byte[]{(byte)0x36});
118     registerCodes('\u0031', new byte[]{(byte)0x38});
119     registerCodes('\u0032', new byte[]{(byte)0x3A});
120     registerCodes('\u0033', new byte[]{(byte)0x3C});
121     registerCodes('\u0034', new byte[]{(byte)0x3E});
122     registerCodes('\u0035', new byte[]{(byte)0x40});
123     registerCodes('\u0036', new byte[]{(byte)0x42});
124     registerCodes('\u0037', new byte[]{(byte)0x44});
125     registerCodes('\u0038', new byte[]{(byte)0x46});
126     registerCodes('\u0039', new byte[]{(byte)0x48});
127     registerCodes('\u003A', new byte[]{(byte)0x20});
128     registerCodes('\u003B', new byte[]{(byte)0x22});
129     registerCodes('\u003C', new byte[]{(byte)0x2E});
130     registerCodes('\u003D', new byte[]{(byte)0x30});
131     registerCodes('\u003E', new byte[]{(byte)0x32});
132     registerCodes('\u003F', new byte[]{(byte)0x24});
133     registerCodes('\u0040', new byte[]{(byte)0x26});
134     registerCodes('\u0041', new byte[]{(byte)0x4A});
135     registerCodes('\u0042', new byte[]{(byte)0x4C});
136     registerCodes('\u0043', new byte[]{(byte)0x4D});
137     registerCodes('\u0044', new byte[]{(byte)0x4F});
138     registerCodes('\u0045', new byte[]{(byte)0x51});
139     registerCodes('\u0046', new byte[]{(byte)0x53});
140     registerCodes('\u0047', new byte[]{(byte)0x55});
141     registerCodes('\u0048', new byte[]{(byte)0x57});
142     registerCodes('\u0049', new byte[]{(byte)0x59});
143     registerCodes('\u004A', new byte[]{(byte)0x5B});
144     registerCodes('\u004B', new byte[]{(byte)0x5C});
145     registerCodes('\u004C', new byte[]{(byte)0x5E});
146     registerCodes('\u004D', new byte[]{(byte)0x60});
147     registerCodes('\u004E', new byte[]{(byte)0x62});
148     registerCodes('\u004F', new byte[]{(byte)0x64});
149     registerCodes('\u0050', new byte[]{(byte)0x66});
150     registerCodes('\u0051', new byte[]{(byte)0x68});
151     registerCodes('\u0052', new byte[]{(byte)0x69});
152     registerCodes('\u0053', new byte[]{(byte)0x6B});
153     registerCodes('\u0054', new byte[]{(byte)0x6D});
154     registerCodes('\u0055', new byte[]{(byte)0x6F});
155     registerCodes('\u0056', new byte[]{(byte)0x71});
156     registerCodes('\u0057', new byte[]{(byte)0x73});
157     registerCodes('\u0058', new byte[]{(byte)0x75});
158     registerCodes('\u0059', new byte[]{(byte)0x76});
159     registerCodes('\u005A', new byte[]{(byte)0x78});
160     registerCodes('\u005B', new byte[]{(byte)0x27});
161     registerCodes('\\',     new byte[]{(byte)0x29});
162     registerCodes('\u005D', new byte[]{(byte)0x2A});
163     registerCodes('\u005E', new byte[]{(byte)0x2B, (byte)0x02});
164     registerCodes('\u005F', new byte[]{(byte)0x2B, (byte)0x03});
165     registerCodes('\u0060', new byte[]{(byte)0x2B, (byte)0x07});
166     registerCodes('\u0061', new byte[]{(byte)0x4A});
167     registerCodes('\u0062', new byte[]{(byte)0x4C});
168     registerCodes('\u0063', new byte[]{(byte)0x4D});
169     registerCodes('\u0064', new byte[]{(byte)0x4F});
170     registerCodes('\u0065', new byte[]{(byte)0x51});
171     registerCodes('\u0066', new byte[]{(byte)0x53});
172     registerCodes('\u0067', new byte[]{(byte)0x55});
173     registerCodes('\u0068', new byte[]{(byte)0x57});
174     registerCodes('\u0069', new byte[]{(byte)0x59});
175     registerCodes('\u006A', new byte[]{(byte)0x5B});
176     registerCodes('\u006B', new byte[]{(byte)0x5C});
177     registerCodes('\u006C', new byte[]{(byte)0x5E});
178     registerCodes('\u006D', new byte[]{(byte)0x60});
179     registerCodes('\u006E', new byte[]{(byte)0x62});
180     registerCodes('\u006F', new byte[]{(byte)0x64});
181     registerCodes('\u0070', new byte[]{(byte)0x66});
182     registerCodes('\u0071', new byte[]{(byte)0x68});
183     registerCodes('\u0072', new byte[]{(byte)0x69});
184     registerCodes('\u0073', new byte[]{(byte)0x6B});
185     registerCodes('\u0074', new byte[]{(byte)0x6D});
186     registerCodes('\u0075', new byte[]{(byte)0x6F});
187     registerCodes('\u0076', new byte[]{(byte)0x71});
188     registerCodes('\u0077', new byte[]{(byte)0x73});
189     registerCodes('\u0078', new byte[]{(byte)0x75});
190     registerCodes('\u0079', new byte[]{(byte)0x76});
191     registerCodes('\u007A', new byte[]{(byte)0x78});
192     registerCodes('\u007B', new byte[]{(byte)0x2B, (byte)0x09});
193     registerCodes('\u007C', new byte[]{(byte)0x2B, (byte)0x0B});
194     registerCodes('\u007D', new byte[]{(byte)0x2B, (byte)0x0D});
195     registerCodes('\u007E', new byte[]{(byte)0x2B, (byte)0x0F});
196     registerCodes('\u00A0', new byte[]{(byte)0x08, (byte)0x02});
197     registerCodes('\u00A1', new byte[]{(byte)0x2B, (byte)0x10});
198     registerCodes('\u00A2', new byte[]{(byte)0x34, (byte)0xA6});
199     registerCodes('\u00A3', new byte[]{(byte)0x34, (byte)0xA7});
200     registerCodes('\u00A4', new byte[]{(byte)0x34, (byte)0xA8});
201     registerCodes('\u00A5', new byte[]{(byte)0x34, (byte)0xA9});
202     registerCodes('\u00A6', new byte[]{(byte)0x2B, (byte)0x11});
203     registerCodes('\u00A7', new byte[]{(byte)0x34, (byte)0xAA});
204     registerCodes('\u00A8', new byte[]{(byte)0x2B, (byte)0x12});
205     registerCodes('\u00A9', new byte[]{(byte)0x34, (byte)0xAB});
206     registerCodes('\u00AB', new byte[]{(byte)0x33, (byte)0x05});
207     registerCodes('\u00AC', new byte[]{(byte)0x34, (byte)0xAC});
208     registerCodes('\u00AE', new byte[]{(byte)0x34, (byte)0xAD});
209     registerCodes('\u00AF', new byte[]{(byte)0x2B, (byte)0x13});
210     registerCodes('\u00B0', new byte[]{(byte)0x34, (byte)0xAE});
211     registerCodes('\u00B1', new byte[]{(byte)0x33, (byte)0x04});
212     registerCodes('\u00B2', new byte[]{(byte)0x3A});
213     registerCodes('\u00B3', new byte[]{(byte)0x3C});
214     registerCodes('\u00B4', new byte[]{(byte)0x2B, (byte)0x14});
215     registerCodes('\u00B5', new byte[]{(byte)0x34, (byte)0xAF});
216     registerCodes('\u00B6', new byte[]{(byte)0x34, (byte)0xB0});
217     registerCodes('\u00B7', new byte[]{(byte)0x34, (byte)0xB1});
218     registerCodes('\u00B8', new byte[]{(byte)0x2B, (byte)0x15});
219     registerCodes('\u00B9', new byte[]{(byte)0x38});
220     registerCodes('\u00BB', new byte[]{(byte)0x33, (byte)0x07});
221     registerCodes('\u00BC', new byte[]{(byte)0x37, (byte)0x12});
222     registerCodes('\u00BD', new byte[]{(byte)0x37, (byte)0x16});
223     registerCodes('\u00BE', new byte[]{(byte)0x37, (byte)0x1A});
224     registerCodes('\u00BF', new byte[]{(byte)0x2B, (byte)0x16});
225     registerCodes('\u00C6', new byte[]{(byte)0x4A, (byte)0x51});
226     registerCodes('\u00D7', new byte[]{(byte)0x33, (byte)0x09});
227     registerCodes('\u00DE', new byte[]{(byte)0x6D, (byte)0x57});
228     registerCodes('\u00DF', new byte[]{(byte)0x6B, (byte)0x6B});
229     registerCodes('\u00E6', new byte[]{(byte)0x4A, (byte)0x51});
230     registerCodes('\u00F7', new byte[]{(byte)0x33, (byte)0x0A});
231     registerCodes('\u00FE', new byte[]{(byte)0x6D, (byte)0x57});
232 
233     registerUnprintableCodes('\u0001', new byte[]{(byte)0x03});
234     registerUnprintableCodes('\u0002', new byte[]{(byte)0x04});
235     registerUnprintableCodes('\u0003', new byte[]{(byte)0x05});
236     registerUnprintableCodes('\u0004', new byte[]{(byte)0x06});
237     registerUnprintableCodes('\u0005', new byte[]{(byte)0x07});
238     registerUnprintableCodes('\u0006', new byte[]{(byte)0x08});
239     registerUnprintableCodes('\u0007', new byte[]{(byte)0x09});
240     registerUnprintableCodes('\b',     new byte[]{(byte)0x0A});
241     registerUnprintableCodes('\u000E', new byte[]{(byte)0x0B});
242     registerUnprintableCodes('\u000F', new byte[]{(byte)0x0C});
243     registerUnprintableCodes('\u0010', new byte[]{(byte)0x0D});
244     registerUnprintableCodes('\u0011', new byte[]{(byte)0x0E});
245     registerUnprintableCodes('\u0012', new byte[]{(byte)0x0F});
246     registerUnprintableCodes('\u0013', new byte[]{(byte)0x10});
247     registerUnprintableCodes('\u0014', new byte[]{(byte)0x11});
248     registerUnprintableCodes('\u0015', new byte[]{(byte)0x12});
249     registerUnprintableCodes('\u0016', new byte[]{(byte)0x13});
250     registerUnprintableCodes('\u0017', new byte[]{(byte)0x14});
251     registerUnprintableCodes('\u0018', new byte[]{(byte)0x15});
252     registerUnprintableCodes('\u0019', new byte[]{(byte)0x16});
253     registerUnprintableCodes('\u001A', new byte[]{(byte)0x17});
254     registerUnprintableCodes('\u001B', new byte[]{(byte)0x18});
255     registerUnprintableCodes('\u001C', new byte[]{(byte)0x19});
256     registerUnprintableCodes('\u001D', new byte[]{(byte)0x1A});
257     registerUnprintableCodes('\u001E', new byte[]{(byte)0x1B});
258     registerUnprintableCodes('\u001F', new byte[]{(byte)0x1C});
259     registerUnprintableCodes('\'',     new byte[]{(byte)0x80});
260     registerUnprintableCodes('\u002D', new byte[]{(byte)0x82});
261     registerUnprintableCodes('\u007F', new byte[]{(byte)0x1D});
262     registerUnprintableCodes('\u0080', new byte[]{(byte)0x1E});
263     registerUnprintableCodes('\u0081', new byte[]{(byte)0x1F});
264     registerUnprintableCodes('\u0082', new byte[]{(byte)0x20});
265     registerUnprintableCodes('\u0083', new byte[]{(byte)0x21});
266     registerUnprintableCodes('\u0084', new byte[]{(byte)0x22});
267     registerUnprintableCodes('\u0085', new byte[]{(byte)0x23});
268     registerUnprintableCodes('\u0086', new byte[]{(byte)0x24});
269     registerUnprintableCodes('\u0087', new byte[]{(byte)0x25});
270     registerUnprintableCodes('\u0088', new byte[]{(byte)0x26});
271     registerUnprintableCodes('\u0089', new byte[]{(byte)0x27});
272     registerUnprintableCodes('\u008A', new byte[]{(byte)0x28});
273     registerUnprintableCodes('\u008B', new byte[]{(byte)0x29});
274     registerUnprintableCodes('\u008C', new byte[]{(byte)0x2A});
275     registerUnprintableCodes('\u008D', new byte[]{(byte)0x2B});
276     registerUnprintableCodes('\u008E', new byte[]{(byte)0x2C});
277     registerUnprintableCodes('\u008F', new byte[]{(byte)0x2D});
278     registerUnprintableCodes('\u0090', new byte[]{(byte)0x2E});
279     registerUnprintableCodes('\u0091', new byte[]{(byte)0x2F});
280     registerUnprintableCodes('\u0092', new byte[]{(byte)0x30});
281     registerUnprintableCodes('\u0093', new byte[]{(byte)0x31});
282     registerUnprintableCodes('\u0094', new byte[]{(byte)0x32});
283     registerUnprintableCodes('\u0095', new byte[]{(byte)0x33});
284     registerUnprintableCodes('\u0096', new byte[]{(byte)0x34});
285     registerUnprintableCodes('\u0097', new byte[]{(byte)0x35});
286     registerUnprintableCodes('\u0098', new byte[]{(byte)0x36});
287     registerUnprintableCodes('\u0099', new byte[]{(byte)0x37});
288     registerUnprintableCodes('\u009A', new byte[]{(byte)0x38});
289     registerUnprintableCodes('\u009B', new byte[]{(byte)0x39});
290     registerUnprintableCodes('\u009C', new byte[]{(byte)0x3A});
291     registerUnprintableCodes('\u009D', new byte[]{(byte)0x3B});
292     registerUnprintableCodes('\u009E', new byte[]{(byte)0x3C});
293     registerUnprintableCodes('\u009F', new byte[]{(byte)0x3D});
294     registerUnprintableCodes('\u00AD', new byte[]{(byte)0x83});
295 
296     registerInternationalCodes('\u00AA', new byte[]{(byte)0x4A},
297                                new byte[]{(byte)0x03});
298     registerInternationalCodes('\u00BA', new byte[]{(byte)0x64},
299                                new byte[]{(byte)0x03});
300     registerInternationalCodes('\u00C0', new byte[]{(byte)0x4A},
301                                new byte[]{(byte)0x0F});
302     registerInternationalCodes('\u00C1', new byte[]{(byte)0x4A},
303                                new byte[]{(byte)0x0E});
304     registerInternationalCodes('\u00C2', new byte[]{(byte)0x4A},
305                                new byte[]{(byte)0x12});
306     registerInternationalCodes('\u00C3', new byte[]{(byte)0x4A},
307                                new byte[]{(byte)0x19});
308     registerInternationalCodes('\u00C4', new byte[]{(byte)0x4A},
309                                new byte[]{(byte)0x13});
310     registerInternationalCodes('\u00C5', new byte[]{(byte)0x4A},
311                                new byte[]{(byte)0x1A});
312     registerInternationalCodes('\u00C7', new byte[]{(byte)0x4D},
313                                new byte[]{(byte)0x1C});
314     registerInternationalCodes('\u00C8', new byte[]{(byte)0x51},
315                                new byte[]{(byte)0x0F});
316     registerInternationalCodes('\u00C9', new byte[]{(byte)0x51},
317                                new byte[]{(byte)0x0E});
318     registerInternationalCodes('\u00CA', new byte[]{(byte)0x51},
319                                new byte[]{(byte)0x12});
320     registerInternationalCodes('\u00CB', new byte[]{(byte)0x51},
321                                new byte[]{(byte)0x13});
322     registerInternationalCodes('\u00CC', new byte[]{(byte)0x59},
323                                new byte[]{(byte)0x0F});
324     registerInternationalCodes('\u00CD', new byte[]{(byte)0x59},
325                                new byte[]{(byte)0x0E});
326     registerInternationalCodes('\u00CE', new byte[]{(byte)0x59},
327                                new byte[]{(byte)0x12});
328     registerInternationalCodes('\u00CF', new byte[]{(byte)0x59},
329                                new byte[]{(byte)0x13});
330     registerInternationalCodes('\u00D0', new byte[]{(byte)0x4F},
331                                new byte[]{(byte)0x68});
332     registerInternationalCodes('\u00D1', new byte[]{(byte)0x62},
333                                new byte[]{(byte)0x19});
334     registerInternationalCodes('\u00D2', new byte[]{(byte)0x64},
335                                new byte[]{(byte)0x0F});
336     registerInternationalCodes('\u00D3', new byte[]{(byte)0x64},
337                                new byte[]{(byte)0x0E});
338     registerInternationalCodes('\u00D4', new byte[]{(byte)0x64},
339                                new byte[]{(byte)0x12});
340     registerInternationalCodes('\u00D5', new byte[]{(byte)0x64},
341                                new byte[]{(byte)0x19});
342     registerInternationalCodes('\u00D6', new byte[]{(byte)0x64},
343                                new byte[]{(byte)0x13});
344     registerInternationalCodes('\u00D8', new byte[]{(byte)0x64},
345                                new byte[]{(byte)0x21});
346     registerInternationalCodes('\u00D9', new byte[]{(byte)0x6F},
347                                new byte[]{(byte)0x0F});
348     registerInternationalCodes('\u00DA', new byte[]{(byte)0x6F},
349                                new byte[]{(byte)0x0E});
350     registerInternationalCodes('\u00DB', new byte[]{(byte)0x6F},
351                                new byte[]{(byte)0x12});
352     registerInternationalCodes('\u00DC', new byte[]{(byte)0x6F},
353                                new byte[]{(byte)0x13});
354     registerInternationalCodes('\u00DD', new byte[]{(byte)0x76},
355                                new byte[]{(byte)0x0E});
356     registerInternationalCodes('\u00E0', new byte[]{(byte)0x4A},
357                                new byte[]{(byte)0x0F});
358     registerInternationalCodes('\u00E1', new byte[]{(byte)0x4A},
359                                new byte[]{(byte)0x0E});
360     registerInternationalCodes('\u00E2', new byte[]{(byte)0x4A},
361                                new byte[]{(byte)0x12});
362     registerInternationalCodes('\u00E3', new byte[]{(byte)0x4A},
363                                new byte[]{(byte)0x19});
364     registerInternationalCodes('\u00E4', new byte[]{(byte)0x4A},
365                                new byte[]{(byte)0x13});
366     registerInternationalCodes('\u00E5', new byte[]{(byte)0x4A},
367                                new byte[]{(byte)0x1A});
368     registerInternationalCodes('\u00E7', new byte[]{(byte)0x4D},
369                                new byte[]{(byte)0x1C});
370     registerInternationalCodes('\u00E8', new byte[]{(byte)0x51},
371                                new byte[]{(byte)0x0F});
372     registerInternationalCodes('\u00E9', new byte[]{(byte)0x51},
373                                new byte[]{(byte)0x0E});
374     registerInternationalCodes('\u00EA', new byte[]{(byte)0x51},
375                                new byte[]{(byte)0x12});
376     registerInternationalCodes('\u00EB', new byte[]{(byte)0x51},
377                                new byte[]{(byte)0x13});
378     registerInternationalCodes('\u00EC', new byte[]{(byte)0x59},
379                                new byte[]{(byte)0x0F});
380     registerInternationalCodes('\u00ED', new byte[]{(byte)0x59},
381                                new byte[]{(byte)0x0E});
382     registerInternationalCodes('\u00EE', new byte[]{(byte)0x59},
383                                new byte[]{(byte)0x12});
384     registerInternationalCodes('\u00EF', new byte[]{(byte)0x59},
385                                new byte[]{(byte)0x13});
386     registerInternationalCodes('\u00F0', new byte[]{(byte)0x4F},
387                                new byte[]{(byte)0x68});
388     registerInternationalCodes('\u00F1', new byte[]{(byte)0x62},
389                                new byte[]{(byte)0x19});
390     registerInternationalCodes('\u00F2', new byte[]{(byte)0x64},
391                                new byte[]{(byte)0x0F});
392     registerInternationalCodes('\u00F3', new byte[]{(byte)0x64},
393                                new byte[]{(byte)0x0E});
394     registerInternationalCodes('\u00F4', new byte[]{(byte)0x64},
395                                new byte[]{(byte)0x12});
396     registerInternationalCodes('\u00F5', new byte[]{(byte)0x64},
397                                new byte[]{(byte)0x19});
398     registerInternationalCodes('\u00F6', new byte[]{(byte)0x64},
399                                new byte[]{(byte)0x13});
400     registerInternationalCodes('\u00F8', new byte[]{(byte)0x64},
401                                new byte[]{(byte)0x21});
402     registerInternationalCodes('\u00F9', new byte[]{(byte)0x6F},
403                                new byte[]{(byte)0x0F});
404     registerInternationalCodes('\u00FA', new byte[]{(byte)0x6F},
405                                new byte[]{(byte)0x0E});
406     registerInternationalCodes('\u00FB', new byte[]{(byte)0x6F},
407                                new byte[]{(byte)0x12});
408     registerInternationalCodes('\u00FC', new byte[]{(byte)0x6F},
409                                new byte[]{(byte)0x13});
410     registerInternationalCodes('\u00FD', new byte[]{(byte)0x76},
411                                new byte[]{(byte)0x0E});
412     registerInternationalCodes('\u00FF', new byte[]{(byte)0x76},
413                                new byte[]{(byte)0x13});
414     
415   }
416 
417   
418   private IndexCodes() {
419   }
420 
421   private static void registerCodes(char c, byte[] codes) {
422     CODES.put(c, codes);
423   }
424   
425   private static void registerUnprintableCodes(char c, byte[] codes) {
426     UNPRINTABLE_CODES.put(c, codes);
427   }
428   
429   private static void registerInternationalCodes(
430       char c, byte[] inlineCodes, byte[] extraCodes) {
431     INTERNATIONAL_CODES.put(c,
432                             new InternationalCodes(inlineCodes, extraCodes));
433   }
434   
435   static boolean isNullEntry(byte startEntryFlag) {
436     return((startEntryFlag == ASC_NULL_FLAG) ||
437            (startEntryFlag == DESC_NULL_FLAG));
438   }
439   
440   static byte getNullEntryFlag(boolean isAscending) {
441     return(isAscending ? ASC_NULL_FLAG : DESC_NULL_FLAG);
442   }
443   
444   static byte getStartEntryFlag(boolean isAscending) {
445     return(isAscending ? ASC_START_FLAG : DESC_START_FLAG);
446   }
447   
448   static final class InternationalCodes {
449     public final byte[] _inlineCodes;
450     public final byte[] _extraCodes;
451 
452     private InternationalCodes(byte[] inlineCodes, byte[] extraCodes) {
453       _inlineCodes = inlineCodes;
454       _extraCodes = extraCodes;
455     }
456   }
457   
458 }