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