i'm sorry, there is get child count after get the child address. so it seam good.
2010/3/22 a a <[email protected]>: > Dear All, > I met a big difficiult problem, i have researched more then 5 > day's. Of course i read the LatinIME's algorithm for the suggestion. > It following like that > > getSuggestions-->getWordsRec, and getWordsRec invoke itself when it > have a child. So the key algorithm is where is it's child.And it is: > intDictionary::getAddress(int *pos) // the pos is a father node > { > int address = 0; > if ((mDict[*pos] & FLAG_ADDRESS_MASK) == 0) { //// The bit that > decides if an address follows in the next 22 bits > > // #define FLAG_ADDRESS_MASK 0x40 > > // 22-bit address = ~4MB dictionary size > limit, which on average would be about 200k-300k words > > *pos += 1; // so it looks never go into this branch when the > dictionay is less then 4MB, and my dictionary is only 500KB > } else { > address += (mDict[*pos] & (ADDRESS_MASK >> 16)) << 16; // > address += (mDict[*pos + 1] & 0xFF) << 8; > // > address += (mDict[*pos + 2] & 0xFF); > // > *pos += 3; > } > return address; //the address is child node's > } > For example, we typed "as", the first node is find the "a" at the root > layler, and then find "s" on the "a" child. > Anyone can tell me what's the getAddress() meanings? i really can't > understand it well. My question is why > the child address is always : > > address += (mDict[*pos] & (ADDRESS_MASK >> 16)) << 16; // > address += (mDict[*pos + 1] & 0xFF) << 8; > // > address += (mDict[*pos + 2] & 0xFF); > // > > If the "a" have more then two child, it will only get one child, > because it always get it's child address like above. > -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe from this group, send email to android-developers+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.

