You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Al Chou <ho...@yahoo.com> on 2003/07/03 21:50:47 UTC

[math] Fwd: Re: Change utility class to singleton with interface?

The beginnings of a thread in the Refactoring Yahoo list that may be of
interest for our current design discussions:

Change utility class to singleton with interface?
http://groups.yahoo.com/group/refactoring/message/3797


Al

=====
Albert Davidson Chou

    Get answers to Mac questions at http://www.Mac-Mgrs.org/ .

__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Re: [math] Fwd: Re: Change utility class to singleton with interface?

Posted by "Mark R. Diggory" <md...@latte.harvard.edu>.
This could be something a simple as:

package org.apache.commons.math.stat2;

import org.apache.commons.math.stat2.univariate.moment.Mean;
import org.apache.commons.math.stat2.univariate.moment.Variance;

public class StatUtils {
   
    private static Mean _mean;
    private static Variance _variance;
   
    public double mean(double[] values) {
        return _mean.evaluate(values);       
    }

    public double variance(double[] values) {
        return _variance.evaluate(values);       
    }
   
    static {
        _mean = new Mean();
        _variance = new Variance();
    }
}

thanks Al,
Mark

Al Chou wrote:

>The beginnings of a thread in the Refactoring Yahoo list that may be of
>interest for our current design discussions:
>
>Change utility class to singleton with interface?
>http://groups.yahoo.com/group/refactoring/message/3797
>
>
>Al
>
>=====
>Albert Davidson Chou
>
>    Get answers to Mac questions at http://www.Mac-Mgrs.org/ .
>
>__________________________________
>Do you Yahoo!?
>SBC Yahoo! DSL - Now only $29.95 per month!
>http://sbc.yahoo.com
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>
>
>  
>


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org