private bool LoadGroups(CollationData data) { headerLength = 1 + NUM_SPECIAL_GROUPS; int r0 = (CollationFastLatin.Version << 8) | headerLength; result.Append((char)r0); // The first few reordering groups should be special groups // (space, punct, ..., digit) followed by Latn, then Grek and other scripts. for (int i = 0; i < NUM_SPECIAL_GROUPS; ++i) { lastSpecialPrimaries[i] = data.GetLastPrimaryForGroup(ReorderCodes.First + i); if (lastSpecialPrimaries[i] == 0) { // missing data return(false); } // ICU4N: Use char instead of int to append the value to ensure ambient culture has no effect result.Append('0'); // reserve a slot for this group } firstDigitPrimary = data.GetFirstPrimaryForGroup(ReorderCodes.Digit); firstLatinPrimary = data.GetFirstPrimaryForGroup(UScript.Latin); lastLatinPrimary = data.GetLastPrimaryForGroup(UScript.Latin); if (firstDigitPrimary == 0 || firstLatinPrimary == 0) { // missing data return(false); } return(true); }
private bool LoadGroups(CollationData data) { headerLength = 1 + NUM_SPECIAL_GROUPS; int r0 = (CollationFastLatin.VERSION << 8) | headerLength; result.Append((char)r0); // The first few reordering groups should be special groups // (space, punct, ..., digit) followed by Latn, then Grek and other scripts. for (int i = 0; i < NUM_SPECIAL_GROUPS; ++i) { lastSpecialPrimaries[i] = data.GetLastPrimaryForGroup(ReorderCodes.First + i); if (lastSpecialPrimaries[i] == 0) { // missing data return(false); } // ICU4N TODO: Check this (not sure about char data type) result.Append((char)0); // reserve a slot for this group } firstDigitPrimary = data.GetFirstPrimaryForGroup(ReorderCodes.Digit); firstLatinPrimary = data.GetFirstPrimaryForGroup(UScript.Latin); lastLatinPrimary = data.GetLastPrimaryForGroup(UScript.Latin); if (firstDigitPrimary == 0 || firstLatinPrimary == 0) { // missing data return(false); } return(true); }