132 * @return the Unicode version number
133 */
134 public VersionInfo getAge(int codepoint)
135 {
136 int version = getAdditional(codepoint, 0) >> AGE_SHIFT_;
137 return VersionInfo.getInstance(
138 (version >> FIRST_NIBBLE_SHIFT_) & LAST_NIBBLE_MASK_,
139 version & LAST_NIBBLE_MASK_, 0, 0);
140 }
141
142 // int-value and enumerated properties --------------------------------- ***
143
144 public int getType(int c) {
145 return getProperty(c)&TYPE_MASK;
146 }
147
148 /*
149 * Map some of the Grapheme Cluster Break values to Hangul Syllable Types.
150 * Hangul_Syllable_Type is fully redundant with a subset of Grapheme_Cluster_Break.
151 */
152 private static final int /* UHangulSyllableType */ gcbToHst[]={
153 HangulSyllableType.NOT_APPLICABLE, /* U_GCB_OTHER */
154 HangulSyllableType.NOT_APPLICABLE, /* U_GCB_CONTROL */
155 HangulSyllableType.NOT_APPLICABLE, /* U_GCB_CR */
156 HangulSyllableType.NOT_APPLICABLE, /* U_GCB_EXTEND */
157 HangulSyllableType.LEADING_JAMO, /* U_GCB_L */
158 HangulSyllableType.NOT_APPLICABLE, /* U_GCB_LF */
159 HangulSyllableType.LV_SYLLABLE, /* U_GCB_LV */
160 HangulSyllableType.LVT_SYLLABLE, /* U_GCB_LVT */
161 HangulSyllableType.TRAILING_JAMO, /* U_GCB_T */
162 HangulSyllableType.VOWEL_JAMO /* U_GCB_V */
163 /*
164 * Omit GCB values beyond what we need for hst.
165 * The code below checks for the array length.
166 */
167 };
168
169 private class IntProperty {
170 int column; // SRC_PROPSVEC column, or "source" if mask==0
171 int mask;
172 int shift;
275
276 public int digit(int c) {
277 int value = getNumericTypeValue(getProperty(c)) - NTV_DECIMAL_START_;
278 if(value<=9) {
279 return value;
280 } else {
281 return -1;
282 }
283 }
284
285 // protected variables -----------------------------------------------
286
287 /**
288 * Extra property trie
289 */
290 Trie2_16 m_additionalTrie_;
291 /**
292 * Extra property vectors, 1st column for age and second for binary
293 * properties.
294 */
295 int m_additionalVectors_[];
296 /**
297 * Number of additional columns
298 */
299 int m_additionalColumnsCount_;
300 /**
301 * Maximum values for block, bits used as in vector word
302 * 0
303 */
304 int m_maxBlockScriptValue_;
305 /**
306 * Maximum values for script, bits used as in vector word
307 * 0
308 */
309 int m_maxJTGValue_;
310 /**
311 * Script_Extensions data
312 */
313 public char[] m_scriptExtensions_;
314
315 // private variables -------------------------------------------------
546 // additional properties
547 int size = scriptExtensionsOffset - additionalVectorsOffset;
548 m_additionalVectors_ = new int[size];
549 for (int i = 0; i < size; i ++) {
550 m_additionalVectors_[i] = bytes.getInt();
551 }
552 }
553
554 // Script_Extensions
555 int numChars = (reservedOffset7 - scriptExtensionsOffset) * 2;
556 if(numChars > 0) {
557 m_scriptExtensions_ = new char[numChars];
558 for(int i = 0; i < numChars; ++i) {
559 m_scriptExtensions_[i] = bytes.getChar();
560 }
561 }
562 }
563
564 private static final class IsAcceptable implements ICUBinary.Authenticate {
565 // @Override when we switch to Java 6
566 public boolean isDataVersionAcceptable(byte version[]) {
567 return version[0] == 7;
568 }
569 }
570
571 private static final int DATA_FORMAT = 0x5550726F; // "UPro"
572
573 public void upropsvec_addPropertyStarts(UnicodeSet set) {
574 /* add the start code point of each same-value range of the properties vectors trie */
575 if(m_additionalColumnsCount_>0) {
576 /* if m_additionalColumnsCount_==0 then the properties vectors trie may not be there at all */
577 Iterator<Trie2.Range> trieIterator = m_additionalTrie_.iterator();
578 Trie2.Range range;
579 while(trieIterator.hasNext() && !(range=trieIterator.next()).leadSurrogate) {
580 set.add(range.startCodePoint);
581 }
582 }
583 }
584
585 // This static initializer block must be placed after
586 // other static member initialization
|
132 * @return the Unicode version number
133 */
134 public VersionInfo getAge(int codepoint)
135 {
136 int version = getAdditional(codepoint, 0) >> AGE_SHIFT_;
137 return VersionInfo.getInstance(
138 (version >> FIRST_NIBBLE_SHIFT_) & LAST_NIBBLE_MASK_,
139 version & LAST_NIBBLE_MASK_, 0, 0);
140 }
141
142 // int-value and enumerated properties --------------------------------- ***
143
144 public int getType(int c) {
145 return getProperty(c)&TYPE_MASK;
146 }
147
148 /*
149 * Map some of the Grapheme Cluster Break values to Hangul Syllable Types.
150 * Hangul_Syllable_Type is fully redundant with a subset of Grapheme_Cluster_Break.
151 */
152 private static final int[] /* UHangulSyllableType */ gcbToHst={
153 HangulSyllableType.NOT_APPLICABLE, /* U_GCB_OTHER */
154 HangulSyllableType.NOT_APPLICABLE, /* U_GCB_CONTROL */
155 HangulSyllableType.NOT_APPLICABLE, /* U_GCB_CR */
156 HangulSyllableType.NOT_APPLICABLE, /* U_GCB_EXTEND */
157 HangulSyllableType.LEADING_JAMO, /* U_GCB_L */
158 HangulSyllableType.NOT_APPLICABLE, /* U_GCB_LF */
159 HangulSyllableType.LV_SYLLABLE, /* U_GCB_LV */
160 HangulSyllableType.LVT_SYLLABLE, /* U_GCB_LVT */
161 HangulSyllableType.TRAILING_JAMO, /* U_GCB_T */
162 HangulSyllableType.VOWEL_JAMO /* U_GCB_V */
163 /*
164 * Omit GCB values beyond what we need for hst.
165 * The code below checks for the array length.
166 */
167 };
168
169 private class IntProperty {
170 int column; // SRC_PROPSVEC column, or "source" if mask==0
171 int mask;
172 int shift;
275
276 public int digit(int c) {
277 int value = getNumericTypeValue(getProperty(c)) - NTV_DECIMAL_START_;
278 if(value<=9) {
279 return value;
280 } else {
281 return -1;
282 }
283 }
284
285 // protected variables -----------------------------------------------
286
287 /**
288 * Extra property trie
289 */
290 Trie2_16 m_additionalTrie_;
291 /**
292 * Extra property vectors, 1st column for age and second for binary
293 * properties.
294 */
295 int[] m_additionalVectors_;
296 /**
297 * Number of additional columns
298 */
299 int m_additionalColumnsCount_;
300 /**
301 * Maximum values for block, bits used as in vector word
302 * 0
303 */
304 int m_maxBlockScriptValue_;
305 /**
306 * Maximum values for script, bits used as in vector word
307 * 0
308 */
309 int m_maxJTGValue_;
310 /**
311 * Script_Extensions data
312 */
313 public char[] m_scriptExtensions_;
314
315 // private variables -------------------------------------------------
546 // additional properties
547 int size = scriptExtensionsOffset - additionalVectorsOffset;
548 m_additionalVectors_ = new int[size];
549 for (int i = 0; i < size; i ++) {
550 m_additionalVectors_[i] = bytes.getInt();
551 }
552 }
553
554 // Script_Extensions
555 int numChars = (reservedOffset7 - scriptExtensionsOffset) * 2;
556 if(numChars > 0) {
557 m_scriptExtensions_ = new char[numChars];
558 for(int i = 0; i < numChars; ++i) {
559 m_scriptExtensions_[i] = bytes.getChar();
560 }
561 }
562 }
563
564 private static final class IsAcceptable implements ICUBinary.Authenticate {
565 // @Override when we switch to Java 6
566 public boolean isDataVersionAcceptable(byte[] version) {
567 return version[0] == 7;
568 }
569 }
570
571 private static final int DATA_FORMAT = 0x5550726F; // "UPro"
572
573 public void upropsvec_addPropertyStarts(UnicodeSet set) {
574 /* add the start code point of each same-value range of the properties vectors trie */
575 if(m_additionalColumnsCount_>0) {
576 /* if m_additionalColumnsCount_==0 then the properties vectors trie may not be there at all */
577 Iterator<Trie2.Range> trieIterator = m_additionalTrie_.iterator();
578 Trie2.Range range;
579 while(trieIterator.hasNext() && !(range=trieIterator.next()).leadSurrogate) {
580 set.add(range.startCodePoint);
581 }
582 }
583 }
584
585 // This static initializer block must be placed after
586 // other static member initialization
|