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

Sebb commented on MATH-758:
---------------------------

Note that getters can return the array without copying (though returning the 
array itself is best avoided if indexed getters can be used instead).

Using a getter instead of direct access means that it would be possible at a 
later date to change the code to clone the array; this is not possible when 
direct access is allowed.

For sub-classes that access array elements, then a getter(int idx) that gets 
the element would be preferable, as it makes the element read-only. This should 
be applicable in the AbstractWell case.

It's never *necessary* to expose mutable data fields directly, so the default 
should be for all such fields to be private, with access via getters (and 
setters if necessary).
                
> Fields which could be private and/or final
> ------------------------------------------
>
>                 Key: MATH-758
>                 URL: https://issues.apache.org/jira/browse/MATH-758
>             Project: Commons Math
>          Issue Type: Bug
>            Reporter: Sebb
>
> BaseAbstractUnivariateIntegrator has several fields that are not currently 
> changed after construction and could be final:
> protected double absoluteAccuracy;
> protected double relativeAccuracy;
> protected int minimalIterationCount;
> protected Incrementor iterations;
> protected Incrementor evaluations;
> These all have getters as well, so could also be made private.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to