You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Eks Dev (JIRA)" <ji...@apache.org> on 2009/07/25 15:22:14 UTC

[jira] Created: (LUCENE-1762) Slightly more readable code in TermAttributeImpl

Slightly more readable code in TermAttributeImpl 
-------------------------------------------------

                 Key: LUCENE-1762
                 URL: https://issues.apache.org/jira/browse/LUCENE-1762
             Project: Lucene - Java
          Issue Type: Improvement
          Components: Analysis
            Reporter: Eks Dev
            Priority: Trivial


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: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Commented: (LUCENE-1762) Slightly more readable code in TermAttributeImpl

Posted by "Uwe Schindler (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-1762?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12735358#action_12735358 ] 

Uwe Schindler commented on LUCENE-1762:
---------------------------------------

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

No, this is a static global switch in TokenStream. If you switch it on, TokenStreams and Filters use only the new API forcefully and therefore use the separate Attribute implementations from o.a.l.analysis.tokenattributes. If it is switched off, a old Token instance is used instead, see [http://hudson.zones.apache.org/hudson/job/Lucene-trunk/javadoc/core/org/apache/lucene/analysis/TokenStream.html#setOnlyUseNewAPI(boolean)]. The red color bug is fixed in trunk now :)

There is one problem with the 6 new single attribute instances: They are code duplicates from Token but have no Test. I also think, I should add a missing test similar to TestToken.java and do the same test with 6 Attribute instances.

I will review the other changes later, I have no time today.

> Slightly more readable code in TermAttributeImpl 
> -------------------------------------------------
>
>                 Key: LUCENE-1762
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1762
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: Analysis
>            Reporter: Eks Dev
>            Assignee: Uwe Schindler
>            Priority: Trivial
>         Attachments: LUCENE-1762.patch, 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: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Issue Comment Edited: (LUCENE-1762) Slightly more readable code in TermAttributeImpl

Posted by "Uwe Schindler (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-1762?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12735275#action_12735275 ] 

Uwe Schindler edited comment on LUCENE-1762 at 7/25/09 7:01 AM:
----------------------------------------------------------------

As Token is not yet deprecated, I think, this patch should also apply to Token.java?
Can you prepare that, too?

(This is important, because if the backwards-compatibility layer is enabled with setOnlyUseNewAPI(false)), the TermAttributeImpl is never used and a Token instance is used instead - if no tests fail, this may also be the case :-] )

      was (Author: thetaphi):
    As Token is not yet deprecated, I think, this patch should also apply to Token.java?
Can you prepare that, too?
  
> Slightly more readable code in TermAttributeImpl 
> -------------------------------------------------
>
>                 Key: LUCENE-1762
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1762
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: Analysis
>            Reporter: Eks Dev
>            Assignee: Uwe Schindler
>            Priority: Trivial
>         Attachments: 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: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Issue Comment Edited: (LUCENE-1762) Slightly more readable code in TermAttributeImpl

Posted by "Uwe Schindler (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-1762?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12735796#action_12735796 ] 

Uwe Schindler edited comment on LUCENE-1762 at 7/27/09 2:56 PM:
----------------------------------------------------------------

Extended patch. It adds also tests for the basic attributes (in trunk only token was tested). The new tests check every impls basic functionality and clone/copyTo. It also contains the buffer tests of Token for TermAttribute.

To apply the patch you must first do a:
{code}
svn copy src/test/org/apache/lucene/analysis/TestToken.java src/test/org/apache/lucene/analysis/tokenattributes/TestTermAttributeImpl.java
{code}

It also modified the AttributeImpls default toString() to only print instance fields, not static fields.

      was (Author: thetaphi):
    Extended patch. It adds also tests for the basic attributes (in trunk only token was tested). The new tests check every impls basic functionality and clone/copyTo. It also contains the buffer tests of Token for TermAttribute.

To apply the patch you must first do a:
{code}
svn copy src/test/org/apache/lucene/analysis/Token.java src/test/org/apache/lucene/analysis/tokenattributes/TestTermAttributeImpl.java
{code}

It also modified the AttributeImpls default toString() to only print instance fields, not static fields.
  
> Slightly more readable code in TermAttributeImpl 
> -------------------------------------------------
>
>                 Key: LUCENE-1762
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1762
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: Analysis
>    Affects Versions: 2.9
>            Reporter: Eks Dev
>            Assignee: Uwe Schindler
>            Priority: Trivial
>             Fix For: 2.9
>
>         Attachments: LUCENE-1762.patch, LUCENE-1762.patch, 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: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Updated: (LUCENE-1762) Slightly more readable code in TermAttributeImpl

Posted by "Uwe Schindler (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENE-1762?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Uwe Schindler updated LUCENE-1762:
----------------------------------

    Affects Version/s: 2.9
        Fix Version/s: 2.9

> Slightly more readable code in TermAttributeImpl 
> -------------------------------------------------
>
>                 Key: LUCENE-1762
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1762
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: Analysis
>    Affects Versions: 2.9
>            Reporter: Eks Dev
>            Assignee: Uwe Schindler
>            Priority: Trivial
>             Fix For: 2.9
>
>         Attachments: LUCENE-1762.patch, LUCENE-1762.patch, 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: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Updated: (LUCENE-1762) Slightly more readable code in TermAttributeImpl

Posted by "Uwe Schindler (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENE-1762?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Uwe Schindler updated LUCENE-1762:
----------------------------------

    Attachment: LUCENE-1762-bw.patch

Here the modified BW-test to apply on backwards-branch. It respects the new default buffer size.

> Slightly more readable code in TermAttributeImpl 
> -------------------------------------------------
>
>                 Key: LUCENE-1762
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1762
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: Analysis
>    Affects Versions: 2.9
>            Reporter: Eks Dev
>            Assignee: Uwe Schindler
>            Priority: Trivial
>             Fix For: 2.9
>
>         Attachments: LUCENE-1762-bw.patch, LUCENE-1762.patch, LUCENE-1762.patch, 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: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Closed: (LUCENE-1762) Slightly more readable code in Token/TermAttributeImpl

Posted by "Uwe Schindler (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENE-1762?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Uwe Schindler closed LUCENE-1762.
---------------------------------

    Resolution: Fixed

Committed revision: 799025
This is without CHANGES.txt updates, because nothing was changed that is visible to the outside :-)

Thanks Eks!

> Slightly more readable code in Token/TermAttributeImpl
> ------------------------------------------------------
>
>                 Key: LUCENE-1762
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1762
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: Analysis
>    Affects Versions: 2.9
>            Reporter: Eks Dev
>            Assignee: Uwe Schindler
>            Priority: Trivial
>             Fix For: 2.9
>
>         Attachments: LUCENE-1762-bw.patch, LUCENE-1762.patch, LUCENE-1762.patch, LUCENE-1762.patch, 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 also adds tests for the new basic attribute impls (copies of the Token tests).

-- 
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: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Commented: (LUCENE-1762) Slightly more readable code in TermAttributeImpl

Posted by "Uwe Schindler (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-1762?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12735798#action_12735798 ] 

Uwe Schindler commented on LUCENE-1762:
---------------------------------------

Eks, the original patch looked good, I did not change anything in your code, I only added the above mentioned tests and other changes.

One thing: As TestToken checks the buffer sizes, the test in the backwards-branch for Token must also be changed. I will do this before commit.

> Slightly more readable code in TermAttributeImpl 
> -------------------------------------------------
>
>                 Key: LUCENE-1762
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1762
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: Analysis
>    Affects Versions: 2.9
>            Reporter: Eks Dev
>            Assignee: Uwe Schindler
>            Priority: Trivial
>             Fix For: 2.9
>
>         Attachments: LUCENE-1762.patch, LUCENE-1762.patch, 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: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Updated: (LUCENE-1762) Slightly more readable code in TermAttributeImpl

Posted by "Uwe Schindler (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENE-1762?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Uwe Schindler updated LUCENE-1762:
----------------------------------

    Attachment: LUCENE-1762.patch

Slightly modified patch (some small refactoring). I also fixed a bug in Token, because the Payload was not deep cloned in copyTo(), which is done by the simple attributes and needed for restoring the state in AttributeSource. Also added tests for this.

I think it is ready for commit. I will do this in a day or two.

> Slightly more readable code in TermAttributeImpl 
> -------------------------------------------------
>
>                 Key: LUCENE-1762
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1762
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: Analysis
>    Affects Versions: 2.9
>            Reporter: Eks Dev
>            Assignee: Uwe Schindler
>            Priority: Trivial
>             Fix For: 2.9
>
>         Attachments: LUCENE-1762-bw.patch, LUCENE-1762.patch, LUCENE-1762.patch, LUCENE-1762.patch, 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: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Assigned: (LUCENE-1762) Slightly more readable code in TermAttributeImpl

Posted by "Uwe Schindler (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENE-1762?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Uwe Schindler reassigned LUCENE-1762:
-------------------------------------

    Assignee: Uwe Schindler

> Slightly more readable code in TermAttributeImpl 
> -------------------------------------------------
>
>                 Key: LUCENE-1762
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1762
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: Analysis
>            Reporter: Eks Dev
>            Assignee: Uwe Schindler
>            Priority: Trivial
>         Attachments: 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: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Updated: (LUCENE-1762) Slightly more readable code in TermAttributeImpl

Posted by "Eks Dev (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENE-1762?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

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()

if(termBuffer==null)

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

OLD:
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())

Uwe, 
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: https://issues.apache.org/jira/browse/LUCENE-1762
>             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: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Updated: (LUCENE-1762) Slightly more readable code in Token/TermAttributeImpl

Posted by "Uwe Schindler (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENE-1762?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Uwe Schindler updated LUCENE-1762:
----------------------------------

    Description: 
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 also adds tests for the new basic attribute impls (copies of the Token tests).

  was:
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.

        Summary: Slightly more readable code in Token/TermAttributeImpl  (was: Slightly more readable code in TermAttributeImpl )

> Slightly more readable code in Token/TermAttributeImpl
> ------------------------------------------------------
>
>                 Key: LUCENE-1762
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1762
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: Analysis
>    Affects Versions: 2.9
>            Reporter: Eks Dev
>            Assignee: Uwe Schindler
>            Priority: Trivial
>             Fix For: 2.9
>
>         Attachments: LUCENE-1762-bw.patch, LUCENE-1762.patch, LUCENE-1762.patch, LUCENE-1762.patch, 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 also adds tests for the new basic attribute impls (copies of the Token tests).

-- 
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: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Commented: (LUCENE-1762) Slightly more readable code in TermAttributeImpl

Posted by "Eks Dev (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-1762?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12735809#action_12735809 ] 

Eks Dev commented on LUCENE-1762:
---------------------------------

cool, thanks for the review.   

> Slightly more readable code in TermAttributeImpl 
> -------------------------------------------------
>
>                 Key: LUCENE-1762
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1762
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: Analysis
>    Affects Versions: 2.9
>            Reporter: Eks Dev
>            Assignee: Uwe Schindler
>            Priority: Trivial
>             Fix For: 2.9
>
>         Attachments: LUCENE-1762.patch, LUCENE-1762.patch, 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: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Updated: (LUCENE-1762) Slightly more readable code in TermAttributeImpl

Posted by "Uwe Schindler (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENE-1762?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Uwe Schindler updated LUCENE-1762:
----------------------------------

    Attachment: LUCENE-1762.patch

Extended patch. It adds also tests for the basic attributes (in trunk only token was tested). The new tests check every impls basic functionality and clone/copyTo. It also contains the buffer tests of Token for TermAttribute.

To apply the patch you must first do a:
{code}
svn copy src/test/org/apache/lucene/analysis/Token.java src/test/org/apache/lucene/analysis/tokenattributes/TestTermAttributeImpl.java
{code}

It also modified the AttributeImpls default toString() to only print instance fields, not static fields.

> Slightly more readable code in TermAttributeImpl 
> -------------------------------------------------
>
>                 Key: LUCENE-1762
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1762
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: Analysis
>            Reporter: Eks Dev
>            Assignee: Uwe Schindler
>            Priority: Trivial
>         Attachments: LUCENE-1762.patch, LUCENE-1762.patch, 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: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Updated: (LUCENE-1762) Slightly more readable code in TermAttributeImpl

Posted by "Eks Dev (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENE-1762?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Eks Dev updated LUCENE-1762:
----------------------------

    Attachment: LUCENE-1762.patch

- made allocation in initTermBuffer() consistent with ArrayUtil.getNextSize(int) -  this is ok not to start with MIN_BUFFER_SIZE, but rather with ArrayUtil.getNextSize(MIN_BUFFER_SIZE)... e.g. if getNextSize gets very sensitive to initial conditions one day...
 
- null-ed  termText on switch to termBuffer in resizeTermBuffer (as it was before!) . This was a bug in previous patch  

> Slightly more readable code in TermAttributeImpl 
> -------------------------------------------------
>
>                 Key: LUCENE-1762
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1762
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: Analysis
>            Reporter: Eks Dev
>            Assignee: Uwe Schindler
>            Priority: Trivial
>         Attachments: LUCENE-1762.patch, 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: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Commented: (LUCENE-1762) Slightly more readable code in TermAttributeImpl

Posted by "Uwe Schindler (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-1762?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12735275#action_12735275 ] 

Uwe Schindler commented on LUCENE-1762:
---------------------------------------

As Token is not yet deprecated, I think, this patch should also apply to Token.java?
Can you prepare that, too?

> Slightly more readable code in TermAttributeImpl 
> -------------------------------------------------
>
>                 Key: LUCENE-1762
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1762
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: Analysis
>            Reporter: Eks Dev
>            Priority: Trivial
>         Attachments: 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: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Updated: (LUCENE-1762) Slightly more readable code in TermAttributeImpl

Posted by "Eks Dev (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENE-1762?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Eks Dev updated LUCENE-1762:
----------------------------

    Attachment: LUCENE-1762.patch

> Slightly more readable code in TermAttributeImpl 
> -------------------------------------------------
>
>                 Key: LUCENE-1762
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1762
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: Analysis
>            Reporter: Eks Dev
>            Priority: Trivial
>         Attachments: 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: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org