lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Eks Dev (JIRA)" <>
Subject [jira] Updated: (LUCENE-1762) Slightly more readable code in TermAttributeImpl
Date Sat, 25 Jul 2009 22:53:14 GMT


Eks Dev updated LUCENE-1762:

    Attachment: LUCENE-1762.patch

made the changes in Token along the same lines, 

- had to change one constant in TokenTest as I have changed initial allocation policy of termBuffer
to be consistent with Arayutils.getnextSize()


 termBuffer = new char[ArrayUtil.getNextSize(newSize < MIN_BUFFER_SIZE ? MIN_BUFFER_SIZE
: newSize)]; 

termBuffer = new char[newSize < MIN_BUFFER_SIZE ? MIN_BUFFER_SIZE : newSize]; 

not sure if this is better, but looks more consistent to me (buffer size is always determined
via getNewSize())

setOnlyUseNewAPI(false) does not exist, it was removed with some of the patches lately. It
gets automatically detected via reflection?

> Slightly more readable code in TermAttributeImpl 
> -------------------------------------------------
>                 Key: LUCENE-1762
>                 URL:
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: Analysis
>            Reporter: Eks Dev
>            Assignee: Uwe Schindler
>            Priority: Trivial
>         Attachments: LUCENE-1762.patch, LUCENE-1762.patch
> No big deal. 
> growTermBuffer(int newSize) was using correct, but slightly hard to follow code. 
> the method was returning null as a hint that the current termBuffer has enough space
to the upstream code or reallocated buffer.
> this patch simplifies logic   making this method to only reallocate buffer, nothing more.
> It reduces number of if(null) checks in a few methods and reduces amount of code. 
> all tests pass.

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message