[ 
https://issues.apache.org/jira/browse/LUCENE-4565?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13511342#comment-13511342
 ] 

Shai Erera commented on LUCENE-4565:
------------------------------------

I don't think that youngestChild() is clearer than children() + the javadocs. 
Only contains more characters. Naming is hard, I don't think that the existing 
names are good. Maybe to those who developed the algorithm and know what it 
does. But I didn't understand the word 'youngest' until I saw an example on 
paper.

Therefore whatever we call this method, I think that someone will need to read 
the javadocs (unless we call it childrenThatWereAddedLastToTheTaxonomy). I'll 
proceed with the short names. They're not wrong, they do return one child and 
one sibling (and one parent) of every category. Which child/sibling? Read the 
javadocs.

Maybe tomorrow someone will come up w/ a better structure, where children[i] 
would actually mean oldestChild (and youngestSibling)? I don't know. So why 
commit to it in the API?
                
> Simplify TaxoReader ParentArray/ChildrenArrays
> ----------------------------------------------
>
>                 Key: LUCENE-4565
>                 URL: https://issues.apache.org/jira/browse/LUCENE-4565
>             Project: Lucene - Core
>          Issue Type: Improvement
>          Components: modules/facet
>            Reporter: Shai Erera
>            Assignee: Shai Erera
>            Priority: Minor
>         Attachments: LUCENE-4565.patch
>
>
> TaxoReader exposes two structures which provide information about a 
> categories parent/childs/siblings: ParentArray and ChildrenArrays. 
> ChildrenArrays are derived (i.e. created) from ParentArray.
> I propose to consolidate all that into one API ParentInfo, or 
> CategoryTreeInfo (a better name?) which will provide the same information, 
> only from one object. So instead of making these calls:
> {code}
> int[] parents = taxoReader.getParentArray();
> int[] youngestChilds = taxoReader.getChildrenArrays().getYoungestChildArray();
> int[] olderSiblings = taxoReader.getChildrenArrays().getOlderSiblingArray();
> {code}
> one would make these calls:
> {code}
> int[] parents = taxoReader.getParentInfo().parents();
> int[] youngestChilds = taxoReader.getParentInfo().youngestChilds();
> int[] olderSiblings = taxoReader.getParentInfo().olderSiblings();
> {code}
> Not a big change, just consolidate more code into one logical place. All of 
> these arrays will continue to be lazily allocated.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to