commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Phil Steitz (JIRA)" <>
Subject [jira] Commented: (MATH-506) The static field ChiSquareTestImpl.distribution serves no purpose
Date Sat, 05 Feb 2011 14:53:30 GMT


Phil Steitz commented on MATH-506:

The instance field was there originally so that different ChiSquareDistribution implementations
could be provided at construction time or via a setter (making the underlying ChiSquareDistribution
pluggable).  MATH-349 pointed to a different problem related to mutability of implementation
instances.  The simplest solution to both problems is to eliminate the pluggability, which
the change in MATH-349 does for this class.  The degrees of freedom are always computed from
the data, so there is no need for the constructor that takes a distribution instance as argument.
 Both the constructor and setter can be deprecated in 2.2 and removed in 3.0 unless we want
to keep pluggability, which would require

1) making the distribution field final (so removing the setter)
2) copying, rather than referencing the actual parameter provided to the constructor

I am on the fence on this.  Maybe others can chime in (next week :)

> The static field ChiSquareTestImpl.distribution serves no purpose
> -----------------------------------------------------------------
>                 Key: MATH-506
>                 URL:
>             Project: Commons Math
>          Issue Type: Bug
>    Affects Versions: 3.0
>            Reporter: Sebb
>            Priority: Minor
> The static field ChiSquareTestImpl.distribution serves no purpose.
> There is a setter for it, but in every case where the field is used, it is first overwritten
with a new value.
> The field and the setter should be removed, and the methods that create a new instance
should create a local variable instead.
> For Math 2.1, the field can be removed and the setter deprecated.

This message is automatically generated by JIRA.
For more information on JIRA, see:


View raw message