db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel John Debrunner <...@apache.org>
Subject Re: [jira] Updated: (DERBY-2416) Provide a shell for a subclass of SQLChar which will use the passed Collator to do the collation rather than SQLChar's default collation of UCS_BASIC
Date Sat, 10 Mar 2007 05:08:43 GMT
Dag H. Wanvik wrote:
> "Mamta A. Satoor (JIRA)" <jira@apache.org> writes:
> 
> 
>> I would like reviewers to take note of following comment at line 125 in the new class
>> 			/* Believe it or not, a String might have more
>> 			 * collation elements than characters.
>> 			 * So, we handle that case by increasing the int array
>> 			 * by 5 and copying array elements.
>> 			 */
>> Basically, when the characters in the string are converted to collation elements,
one character can get translated into say 2 collation elements (more info can be found on
it in this url http://www.developertutorials.com/tutorials/java/text-searching-java-050524/page3.html
> 
> Would it not be easier/better to just use an  ArrayList<int> to handle
> any needed expansion for you (in stead of coding it yourself) and
> finally do a toArray()? 

Possibly, but I'm not sure an int[] is the long term solution. Looking 
at RuleBasedCollator it seems to me the better object to cache would be 
the CollationElementIterator itself, rather than the result of iterating 
over it. I would say stay with the int[] and the simple array expansion 
until the functionality is working and then look at improving it. An 
ArrayList<int> could be expensive, is every int going to be expanded to 
an Integer object?

Dan.


Mime
View raw message