lexicographic

lexicographic - Collating Sequence The bit patterns...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Collating Sequence The bit patterns representing a character can be interpreted as an unsigned integer and so the natural order of numbers can be used to order the characters. Collating sequence. The collating sequence of a character set is the order of the underlying bit representation. c1<c2 is defined to be ((int)c1)<((int)c2) . In fact, the cast is a no-op in Java; the bits stay the same, only the interpretation changes. Characters are automatically promoted to integers (no cast is needed). Characters are not automatically promoted to short . One can cast them to short ; this is a bad idea even though no bits are lost, because the 16-bit, twos-compliment representation of short is incompatible with the intuitive, collating sequence of 16-bit char . final char xc = A ; final char zc = \ufb01 ; // fi ligature final short xs = ( short )xc, zs =( short )zc; System.out.println (xc<xz); // true System.out.println (xs<zs); // false This is no unsigned, 16-bit, integral type in Java. There are no unsigned integral types in Java at all. Examples of the Unicode Collating Sequence A < a U+0041 < U+0061 65 < 97 Z < a U+005A < U+0061 90 < 97 a < b U+0061 < U+0062 97 < 98 e < f U+0063 < U+0064 101 < 102 z < n U+007A < U+00F1 122 < 241 o < u U+00F6 < U+00FC 246 < 252 l < w U+0142 < U+0175 322 < 373 < U+03BE < U+03C6 958 < 966 R < 6 = U+222B < U+2247 8747 < 8820 6 = < U+2247 < U+2297...
View Full Document

Page1 / 12

lexicographic - Collating Sequence The bit patterns...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online