1 package net.sf.saxon.codenorm; 2 3 import net.sf.saxon.om.XMLChar; 4 5 import java.util.BitSet ; 6 7 16 public class NormalizerData { 17 static final String copyright = "Copyright © 1998-1999 Unicode, Inc."; 18 19 22 public static final int NOT_COMPOSITE = '\uFFFF'; 23 24 30 public int getCanonicalClass(int ch) { 31 return canonicalClass.get(ch); 32 } 33 34 42 public char getPairwiseComposition(int first, int second) { 43 if (first < 0 || first > 0x10FFFF || second < 0 || second > 0x10FFFF) return NOT_COMPOSITE; 44 return (char)compose.get((first << 16) | second); 45 } 46 47 57 public void getRecursiveDecomposition(boolean canonical, int ch, StringBuffer buffer) { 58 String decomp = decompose.get(ch); 59 if (decomp != null && !(canonical && isCompatibility.get(ch))) { 60 for (int i = 0; i < decomp.length(); ++i) { 61 getRecursiveDecomposition(canonical, decomp.charAt(i), buffer); 62 } 63 } else { if (ch<65536) { 66 buffer.append((char)ch); 67 } else { buffer.append(XMLChar.highSurrogate(ch)); 69 buffer.append(XMLChar.lowSurrogate(ch)); 70 } 71 } 72 } 73 74 78 81 NormalizerData(IntHashtable canonicalClass, IntStringHashtable decompose, 82 IntHashtable compose, BitSet isCompatibility, BitSet isExcluded) { 83 this.canonicalClass = canonicalClass; 84 this.decompose = decompose; 85 this.compose = compose; 86 this.isCompatibility = isCompatibility; 87 this.isExcluded = isExcluded; 88 } 89 90 93 boolean getExcluded (char ch) { 94 return isExcluded.get(ch); 95 } 96 97 100 String getRawDecompositionMapping (char ch) { 101 return decompose.get(ch); 102 } 103 104 108 private IntHashtable canonicalClass; 109 110 119 private IntStringHashtable decompose; 120 121 125 private IntHashtable compose; 126 127 130 private BitSet isCompatibility = new BitSet (); 131 132 136 137 private BitSet isExcluded = new BitSet (); 138 } | Popular Tags |