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

Gilles commented on NUMBERS-123:
--------------------------------

I understand your reluctance.
 However, this discussion also is a hint that the initial setup was not clear 
(and it was hiding a bug in that the fields ONE and ZERO were initialized in an 
awkward way).

Since the constructor is private, its correct usage only depends on the 
components' developers: The sole purpose of the flag is efficiency, when we 
*know* that the call will result in an instance that fulfills the requirements 
for further use of the object.

IOW, the constructor is the lowest-level (flexible) factory whose usage is 
controlled by higher-level factory methods ("of" and "from").

> "BigFraction(double)" is unnecessary
> ------------------------------------
>
>                 Key: NUMBERS-123
>                 URL: https://issues.apache.org/jira/browse/NUMBERS-123
>             Project: Commons Numbers
>          Issue Type: Improvement
>          Components: fraction
>            Reporter: Gilles
>            Assignee: Gilles
>            Priority: Trivial
>             Fix For: 1.0
>
>         Attachments: NUMBERS-123__Javadoc.patch
>
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> Constructor {{BigFraction(double value)}} is only called from the 
> {{from(double value)}} method.
>  Actually, this constructor is misleading as it is indeed primarily a 
> conversion from which appropriate {{numerator}} and {{denominator}} fields 
> are computed; those could be set by
>  the "direct" constructor {{BigFraction(BigInteger num, BigInteger den)}}.
> Moreover, the private field {{ZERO}} goes through this conversion code 
> whereas it could constructed "directly", e.g. using {{of(0)}}. Similarly for 
> field {{ONE}}.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to